Menu

Caution

You are not reading the latest stable version of this documentation. If you want up-to-date information, please have a look at 0.3.5.x.

Using SSH

Like most Linux distributions, you can go “under-the-hood” via SSH (Secure Shell Protocol) if you choose. It’s a good idea to have set up, but generally, all server access is recommended via the UI. If you are auditing, doing dev work, hacking (with an understanding of the consequences), or are directed to by a Start9 support tech, then you may need SSH access.

For security reasons, password access is not available in most situations, so you will need to add an SSH key to your server via the method below.

Creating an SSH Key

  1. Open a terminal and enter the following command:

    ssh-keygen -t ed25519
    

    You will be asked to Enter a file in which to save the key - we recommend you press Enter to use the default location

  2. Create a strong passphrase and save it somewhere safe, or press Enter for no passphrase

Note

The next 3 steps only apply to Linux and macOS. If you are on Windows, please skip down to Registering an SSH Key.

  1. It will inform you that your public key has been saved. Take note of this path:

    Your public key has been saved in /home/user/.ssh/id_ed25519.pub
    
  2. Next, start your system’s ssh-agent:

    eval "$(ssh-agent -s)"
    
  3. Now add your key to it:

    ssh-add ~/.ssh/id_ed25519
    

    Note that if you changed the file name/location in step 1, you will need to use that file/path in this step

Registering an SSH Key

  1. In the StartOS dashboard, navigate to System > SSH.

  2. Click “Add New Key”.

  3. Back in the terminal of your workstation, display and copy your SSH public key (created above):

    On Mac simply copy your key to clipboard by typing the following into a terminal:

    pbcopy < ~/.ssh/id_ed25519.pub
    

    On Linux:

    cat ~/.ssh/id_ed25519.pub
    

    On Windows:

    type .ssh\id_ed25519.pub
    

    Copy the whole resulting line that looks similar to:

    ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINH3tqX71XsPlzYhhoo9CqAP2Yx7gsGTh43bQXr1zqoq user@ema.il
    
  4. Paste that line into the Add New Key text field

    ../../_images/ssh_key_add.jpg
  5. Click Submit

You are now ready to SSH into your server!

Connecting via CLI

  1. You can now access your Start9 server from the command line (Linux and Mac) using:

    ssh start9@SERVER-HOSTNAME
    

Replacing <SERVER-HOSTNAME> with your server’s LAN (<custom-address>.local) address

Note

If you get a scary looking warning that says something like “WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!” - fear not! This is most likely happening because you have recently reflashed or did an update from pre-v0.3.3, which would cause a change in the key for your device’s hostname (e.g. xxxxxxxx.local) or IP address (e.g. 192.168.1.x). The solution is to delete the existing entry from your known_hosts file, which is typically located at ~/.ssh/known_hosts. This will be specified in the warning, along with a helpful line number (in case your file is lengthy).

Connecting via PuTTY on Windows

Following the commands above for Windows will get you in. However, if you prefer a GUI tool, BrewsBitcoin has created a guide for connecting via SSH using PuTTY on Windows.

Using SSH Over Tor

Note

The following guide requires that you have already added an SSH key to your server.

Caution

SSH over Tor is only supported on Linux and macOS, although it can also work on Windows with in PuTTY like this. Note that those instructions use port 9150 but we’ve configured Tor in Windows on the traditional port: 9050.

Setup

  1. First, you’ll need one dependency, torsocks, which will allow you to use SSH over Tor on the machine that you want access with. Select your Linux flavor to install:

    sudo apt install torsocks
    
  2. SSH in:

    Warning

    The changes you make here are on the overlay and won’t persist after a restart of your server.

    ssh start9@<custom-address>.local
    
  3. Elevate yourself to root in chroot edit mode (which will make your changes persist across reboots):

    sudo /usr/lib/embassy/scripts/chroot-and-upgrade
    
  4. Using Vim or Nano, add the following 2 lines to /etc/tor/torrc

    HiddenServiceDir /var/lib/tor/ssh
    HiddenServicePort 22 127.0.0.1:22
    

    Tip

    You can also add these lines by running the following command:

    echo "HiddenServiceDir /var/lib/tor/ssh" >> /etc/tor/torrc && echo "HiddenServicePort 22 127.0.0.1:22" >> /etc/tor/torrc
    
  5. Restart your Start9 server by exiting chroot edit mode:

    exit
    
  6. SSH in to your Start9 server again and gather the “.onion” address that was generated:

    cat /var/lib/tor/ssh/hostname
    

Note

Your newly generated .onion address is unique for SSH access only and should not be confused with the main .onion address for the server.

Configure local SSH client

  1. You’ll need to add the following configuration to your SSH config file, which will allow you to use SSH over Tor on any Unix-based system:

    echo -e "Host *.onion\n  ProxyCommand nc -xlocalhost:9050 %h %p\n" >> ~/.ssh/config
    

    This command adds a wildcard setting for .onion domains to your SSH config file. Any .onion domains you connect to using SSH will use the specified proxy command.

    Note: You only need to run this command only once to set up the SSH Over Tor configuration.

Access

To log in, simply use the following command, using the “.onion” hostname you printed above:

ssh start9@xxxxxxxxxxxxxxxxx.onion