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.
- Click here to get the latest version of PuTTY.
- After downloading and installing, open PuTTY.
- Enter your server name, e.g. ‘server.vacares.com’, into the “Host Name (or IP address)” textbox.
- Enter the port ‘22000’ (unless we have told you to use a different port for your server).
- Click “Open”.
- If you receive a “PuTTY Security Alert” about the host key, click “Yes”.
- A command prompt will appear
login as:
- Type your FTP (or control panel) username and press Enter.
- 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.
- 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.
- Go to Applications > Utilities, and open Terminal.
- 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’.
- 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.
- 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.
- If login was successful, you will see the following prompt appear
[user@yourservername ~]#
- 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.
- Search for and open PuTTYgen.
- Click “Generate”.
- Move your mouse around in the blank area provided until the green bar is full.
- When the key has been generated, select “Save public key” and choose a location on your system to save the public key file.
- 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.
- Click “Save private key” and choose a location on your system to save the private key file.
- 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.
- 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.
- Open PuTTY.
- Navigate to Connection > SSH > Auth (in the left-hand menu).
- Click “Browse”.
- Choose the private key file you saved previously.
- Navigate back to Session.
- Enter your server address in the “Host Name (or IP address)” box.
- Enter “22000” for the port (unless we have told you to use a different port).
- If you wish to save these connection settings for fast connection next time, click “Save”.
- 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.
- Go to Applications > Utilities, and open Terminal.
- In the terminal prompt that appears, type the following command:
cd .ssh
- then check your directory with
pwd
- This should show you the following response:
/Users/[your user name]/.ssh;
- 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
- Just replace ‘Your Name’ with your name and ‘filename’ with the name of the file you want to create to hold your keys.
- When prompted for a passphrase, create a strong, difficult-to-guess passphrase to protect your private key. Hit Enter when done.
- 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
- Copy and paste the contents of the public key to share with the system administrator.
- Once the administrator has added your public key to the authorized_keys file, you can ssh into the server using your private key.
- Open Terminal back up.
- Go to your home directory by using the following command
cd ~/
- 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.
- When prompted, enter the passphrase you created for your private key.
- 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