SSH (Secure Shell) connection is a secure and convenient way to access a server or system remotely. In this article, we will go through the steps to connect to a server using SSH, whether you are using Windows, macOS or Linux.
Requirements for SSH connection
Before you begin, here’s what you’ll need:
- Know the IP address or host name: The IP address or host name of the server you want to connect to.
- Know your username: The username with which you connect to the server.
- Have the private key or password. The private key or password associated with your username.
How to configure a static IP address on the Ubuntu 22.10 server?
SSH connection on Windows
- Step 1: Install PuTTY: To connect to a server via SSH on Windows, download and install PuTTY. It is a free and widely used SSH client. You can download it on the official website.
- Step 2: Configure PuTTY: Launch PuTTY and enter the IP address or host name of the server you want to connect to in the “Host Name (or IP address)” field. So make sure that the SSH port is correct (by default it is port 22) and that the connection is set to “SSH”.
- Step 3: Manage the keys. If you use key authentication, go to Connection >SSH >Auth and select your private key by clicking on Browse next to Private key file for authentication.
- Step 4: Log in. Click Open to start the connection. A terminal window opens, asking you for your user name. Then enter it and press Enter. Then type in your password or, if you are using key authentication, simply confirm the connection.
You are connected to your server via SSH on Windows using PuTTY.
SSH connection on macOS and Linux
On macOS or Linux, you can use the terminal directly to connect to the server.
- Step 1: Open Terminal On macOS, open the Terminal application. While on Linux, open your favorite terminal emulator
- Step 2: Using the SSH command in the terminal, type the following command replacing “username” with your username and “ip_address_or_host_name” with the IP address or host name of the server you wish to connect to:
ssh [email protected]_ip_ou_nom_hôte
Press Enter to initiate the connection.
- Step 3: Authenticate When prompted for your password, type it and press Enter. If you use key authentication, make sure your public key is already added to the server. And that your private key is available on your local system.
If this is the first time you connect to this server, you will see a warning message regarding the authenticity of the host. So type yes and press Enter to accept and continue.
Once authenticated, you are connected to your server via SSH on macOS or Linux.