Connecting to Your Server with SSH

Secure Shell (SSH) provides a secure way to remotely access your server from a command line. This article explains how to establish an SSH connection on either Windows or Mac OS.

Note: If you do not already have an SSH login, please contact our support desk and we will set it up for you. We may ask for your public key, which you can find using the Connecting with a Public/Private Key Pair section of this article.

Windows

Windows does not include a default SSH client, so we recommend installing PuTTY.

  1. Click here to get the latest version of PuTTY.
  2. After downloading and installing, open PuTTY.
  3. Enter your server name, e.g. ‘server.vacares.com’, into the “Host Name (or IP address)” textbox.
  4. Enter the port ‘22000’ (unless we have told you to use a different port for your server).
  5. Click “Open”.
  6. If you receive a “PuTTY Security Alert” about the host key, click “Yes”.
  7. A command prompt will appear
    login as:
  8. Type your FTP (or control panel) username and press Enter.
  9. Next enter your FTP (or control panel) password. You will not see the password as it is being typed, as a security feature. When you are done typing, press Enter.
  10. If login is successful, you will see a “Last login:” message. You are now connected to your server via SSH.
Mac

Mac includes Terminal as a default SSH client.

  1. Go to Applications > Utilities, and open Terminal.
  2. In the terminal prompt that appears, type the following command:
    ssh -p 22000 user@server

    replacing ‘user’ with your username (the same as your DirectAdmin or FTP username) and ‘server’ with your server name, such as ‘server.vacares.com’.

  3. If you see the following message:
    The authenticity of host '198.61.208.131 (198.61.208.131)' can't be established.
    RSA key fingerprint is 47:ff:76:b4:211:0f:11:15:21:bd:92:2f:44:0a:d9:0a.
    Are you sure you want to continue connecting (yes/no)?

    type ‘yes’ and press Enter.

  4. Type the password (the same as your DirectAdmin or FTP password). Note, you will not see the password as it is being typed, as a security feature. When you are done typing, press Enter.
  5. If login was successful, you will see the following prompt appear
    [user@yourservername ~]#
  6. You are now connected to your server via SSH.
Connecting with a Public/Private Key Pair

Instead of logging in with your username and password, you can access SSH with a public and private key pair. You will need to generate these keys if you don’t already have them. Then give your public key to the system admin to add to the server’s authorized_keys file.

Windows

PuTTY comes with a key-generating tool that can be used for this purpose.

  1. Search for and open PuTTYgen.
  2. Click “Generate”.
  3. Move your mouse around in the blank area provided until the green bar is full.
  4. When the key has been generated, select “Save public key” and choose a location on your system to save the public key file.
  5. Enter a passphrase in the “Key passphrase” and “Confirm passphrase” boxes. This passphrase protects your private key and you will be required to enter it whenever you use the key.
  6. Click “Save private key” and choose a location on your system to save the private key file.
  7. The text in the “Public key for pasting into…” box shows your public key. You can copy and paste this to share with the administrator of the server you need ssh access to.
  8. Once your key pair has been created, and you have given your public key to the system administrator to add to the authorized_keys file, you will be able to log into your server using these keys.
  9. Open PuTTY.
  10. Navigate to Connection > SSH > Auth (in the left-hand menu).
  11. Click “Browse”.
  12. Choose the private key file you saved previously.
  13. Navigate back to Session.
  14. Enter your server address in the “Host Name (or IP address)” box.
  15. Enter “22000” for the port (unless we have told you to use a different port).
  16. If you wish to save these connection settings for fast connection next time, click “Save”.
  17. Click “Open” to connect to the server.
Mac

Mac’s Terminal program can be used as an ssh client and can also generate and store its own key pairs.

  1. Go to Applications > Utilities, and open Terminal.
  2. In the terminal prompt that appears, type the following command:
    cd .ssh
  3. then check your directory with
    pwd
  4. This should show you the following response:
    /Users/[your user name]/.ssh;
  5. If this looks correct, then type the following command to create your key pair
    ssh-keygen -t rsa -b 2048 -C "Your Name" -f filename
  6. Just replace ‘Your Name’ with your name and ‘filename’ with the name of the file you want to create to hold your keys.
  7. When prompted for a passphrase, create a strong, difficult-to-guess passphrase to protect your private key. Hit Enter when done.
  8. This created a file named ‘filename’ for your private key and and a file named ‘filename.pub’ for your public key. Type the following command to see your public key:
    cat filename.pub
  9. Copy and paste the contents of the public key to share with the system administrator.
  10. Once the administrator has added your public key to the authorized_keys file, you can ssh into the server using your private key.
  11. Open Terminal back up.
  12. Go to your home directory by using the following command
    cd ~/
  13. Now connect to ssh using your private key by typing the following command
    ssh -p 22000 -i .ssh/filename user@server

    replacing ‘filename’, ‘user’, and ‘server’ with their respective values.

  14. When prompted, enter the passphrase you created for your private key.
  15. If login is successful you will see the following prompt:
    [user@yourservername ~]#

You are now connected to your server via SSH. The next time you connect to ssh, Terminal will remember your private key and you can log in with this command:

ssh -p 22000 user@server