Connect with SSH
How to connect with SSH¶
If you have a Linux server, you can connect to it using SSH. SSH is a secure protocol that allows you to connect to your server and run commands on it. SSH is the preferred method of connecting to your server. Follow the steps under the operating system you are using to connect to your server.
Windows does not include an SSH client by default. You will need to install an SSH client to connect to your server. We recommend using PuTTY. You can download PuTTY from here.
Once you have downloaded PuTTY, you can connect to your server by following these steps:
- Open PuTTY.
- Enter your server's IP address in the "Host Name (or IP address)" field.
- Enter your server's SSH port in the "Port" field. The default SSH port is 22.
- Select "SSH" as the "Connection type".
- Click the "Open" button.
You will be prompted check the SSH key fingerprint. Click the "Accept" button to continue.
Warning
Don't blindly accept the SSH key fingerpint if you've connected to this server before and you know you have not reinstalled the operating system.
Next, you will be prompted to enter your username and password. Enter your username and password and press enter. You will not see your password as you type it.
You should now be connected to your server.
macOS includes an SSH client by default. You can connect to your server by following these steps:
- Open the Terminal application.
- Enter the following command, replacing
username
with your username andserver
with your server's IP address:ssh username@server
- Press enter.
- You will be prompted to accept the SSH key fingerprint. Type
yes
and press enter to continue. - Next, you will be prompted to enter your password. Enter your password and press enter. You will not see your password as you type it.
- You should now be connected to your server.
Linux includes an SSH client by default. You can connect to your server by following these steps:
- Open the Terminal application.
- Enter the following command, replacing
username
with your username andserver
with your server's IP address:ssh username@server
- Press enter.
- You will be prompted to accept the SSH key fingerprint. Type
yes
and press enter to continue. - Next, you will be prompted to enter your password. Enter your password and press enter. You will not see your password as you type it.
You should now be connected to your server.
You can connect to your server using an SSH client on iOS. We recommend using Termius. You can download Termius from the App Store.
Once you have downloaded Termius, you can connect to your server by following these steps:
- Open Termius.
- Tap the "+" button in the top right corner.
- Tap "Host".
- Enter your server's IP address in the "Host" field.
- Enter your server's SSH port in the "Port" field. The default SSH port is 22.
- Enter your username in the "Username" field.
- Tap "Save".
- Tap your server to connect to it.
- You will be prompted to accept the SSH key fingerprint. Tap "Yes" to continue.
- Next, you will be prompted to enter your password. Enter your password and tap "Done". You will not see your password as you type it.
You should now be connected to your server.
You can connect to your server using an SSH client on Android. We recommend using Termius. You can download Termius from the Play Store.
Once you have downloaded Termius, you can connect to your server by following these steps:
- Open Termius.
- Tap the "+" button in the bottom right corner.
- Tap "Host".
- Enter your server's IP address in the "Host" field.
- Enter your server's SSH port in the "Port" field. The default SSH port is 22.
- Enter your username in the "Username" field.
- Tap "Save".
- Tap your server to connect to it.
- You will be prompted to accept the SSH key fingerprint. Tap "Yes" to continue.
- Next, you will be prompted to enter your password. Enter your password and tap "Done". You will not see your password as you type it.
You should now be connected to your server.
Setting up SSH Keys (Passwordless Login)¶
SSH keys allow you to connect to your server without entering a password. This is more secure than using a password, and it is also more convenient. You can set up SSH keys by following these steps based on your operating system:
If you have installed PuTTY, you can use the PuTTYgen application to generate SSH keys. You can open PuTTYgen by searching for it in the Start menu.
Once you have opened PuTTYgen, you can generate SSH keys by following these steps:
- Click the "Generate" button.
- Move your mouse around the blank area to generate randomness.
- Once the key has been generated, you can enter a passphrase to protect your key. This is optional, but recommended.
- Click the "Save public key" button to save your public key. This is the key you will add to your server.
- Click the "Save private key" button to save your private key. This is the key you will use to connect to your server.
You will now need to add your public key to your server. You can do this by following the steps in the "Adding SSH Keys to Your Server" section below.
You can generate SSH keys using the ssh-keygen
command. You can generate SSH keys by following these steps:
- Open the Terminal application.
- Enter the following command, replacing
username
with your username:ssh-keygen -t rsa -b 4096 -C "username"
- Press enter.
- You will be prompted to enter a file to save the key in. Press enter to accept the default location.
- You will be prompted to enter a passphrase to protect your key. This is optional, but recommended.
- You will be prompted to enter the passphrase again to confirm it.
- Your public key will be saved in a file with the same name as the private key, but with a
.pub
extension. You will need to add this public key to your server. You can do this by following the steps in the "Adding SSH Keys to Your Server" section below.
You can generate SSH keys using the ssh-keygen
command. You can generate SSH keys by following these steps:
- Open the Terminal application.
- Enter the following command, replacing
username
with your username:ssh-keygen -t rsa -b 4096 -C "username"
- Press enter.
- You will be prompted to enter a file to save the key in. Press enter to accept the default location.
- You will be prompted to enter a passphrase to protect your key. This is optional, but recommended.
- You will be prompted to enter the passphrase again to confirm it.
- Your public key will be saved in a file with the same name as the private key, but with a
.pub
extension. You will need to add this public key to your server. You can do this by following the steps in the "Adding SSH Keys to Your Server" section below.
Adding SSH Keys to Your Server¶
Once you have generated your SSH keys, you will need to add your public key to your server. Follow the steps for your operating system below:
If you have installed PuTTY, you can use the PuTTYgen application to generate SSH keys. You can open PuTTYgen by searching for it in the Start menu.
Once you have opened PuTTYgen, you can add your public key to your server by following these steps:
- Click the "Load" button.
- Select your public key file and click "Open".
- Click the "Save public key" button to save your public key in a format that can be added to your server.
- Copy the contents of the "Public key for pasting into OpenSSH authorized_keys file" box.
- Open Notepad.
- Paste the contents of the "Public key for pasting into OpenSSH authorized_keys file" box into Notepad.
- Save the file as
authorized_keys
in the.ssh
directory in your home directory. For example, if your username isusername
, you would save the file asC:\Users\username\.ssh\authorized_keys
.
Your public key will now be added to your server. You can now connect to your server without entering a password.
You can add your public key to your server by following these steps:
- Open the Terminal application.
- Enter the following command, replacing
username
with your username andserver
with your server's IP address:ssh-copy-id username@server
- Press enter.
- You will be prompted to enter your password. Enter your password and press enter. You will not see your password as you type it.
Your public key will now be added to your server. You can now connect to your server without entering a password.
You can add your public key to your server by following these steps:
- Open the Terminal application.
- Enter the following command, replacing
username
with your username andserver
with your server's IP address:ssh-copy-id username@server
- Press enter.
- You will be prompted to enter your password. Enter your password and press enter. You will not see your password as you type it.
Your public key will now be added to your server. You can now connect to your server without entering a password.