In this article, we will show you how to connect to your remote Linux server from Windows, Linux, or macOS by using SSH.
What is SSH?
SSH is a network protocol that allows you to connect to a remote system and manage it from the terminal. Basically, it allows you to log into your remote server and execute commands – just without the graphical interface.
In this article, we will cover ways to connect to a Linux system from Windows, Linux, and macOS.
There are two ways to authenticate into a remote server via SSH: password authentication and key-based authentication. This article covers password authentication.
Prerequisites
We assume that either you or your hosting provider have already installed and configured SSH on your remote server.
Before we proceed, you need to have the following information:
- IP Address or a domain name of your remote server (e.g. 209.185.108.134 or mysite.com).
- SSH Port Number on your remote server (the default value is 22).
- Username and Password of a user on your remote server.
Connecting to a Remote Server via SSH
From Windows
Windows users need to install PuTTY, which is a free SSH client for Windows. Pick the Windows Installer (either 64-bit or 32-bit version, depending on your system) on the download page.
Once PuTTY is installed, launch the program and fill out the highlighted fields:
- Change username to an actual user’s name on your server (e.g. john).
- Change 209.185.108.134 to your server’s actual IP address or domain name.
- Change 22 to your server’s SSH port (22 is common because it's the default SSH port).
Then click on Open and accept the certificate in the pop-up window.
If all is well, you will be prompted to the final step: entering the password for the remote server's user.
Congratulations, you are now able to execute commands on your remote server.
From macOS
Apple users have it the easiest. You don't have to install SSH because it is already present on your system. The only thing you need to do is to use the SSH command.
Navigate to Applications -> Utilities, and click on Terminal.
You will see a terminal window where you can enter commands.
Type in the following command from your terminal to connect to your remote server:
ssh username@server_ip -p port_number
- Change username to an actual user’s name on your server (e.g. john).
- Change server_ip to your server’s IP address or domain name (e.g. 209.185.108.134 or mysite.com).
- Change port_number to your server’s SSH port (the default value is 22).
Here's an example of an SSH command:
ssh [email protected] -p 1500
If all is well, you will be prompted to the final step: entering the password (in this case, for the user john).
Congratulations, you are now able to execute commands on your remote server.
From Linux
The first thing you need to do is install the openssh-server on your Linux system.
Here's how to do it for Ubuntu, Debian, Mint and other similar distributions:
sudo apt-get install openssh-server
sudo systemctl start ssh
sudo systemctl enable ssh
Here's how to do it for CentOS 8:
sudo dnf install openssh-server
sudo systemctl start sshd
sudo systemctl enable sshd
Note: Other Linux distributions might require different commands for openssh-server installation.
Once SSH is installed, execute the following command from your terminal to connect to your remote server:
ssh username@server_ip -p port_number
- Change username to an actual user’s name on your server (e.g. john).
- Change server_ip to your server’s IP address or domain name (e.g. 209.185.108.134 or mysite.com).
- Change port_number to your server’s SSH port (the default value is 22).
Here's an example of an SSH command:
ssh [email protected] -p 1500
If all is well, you will be prompted to the final step: entering the password (in this case, for the user john).
Congratulations, you are now able to execute commands on your remote server.