In the early days of computing, administrators managed remote servers using protocols like Telnet, which sent data—including passwords—in plain text across the internet, making it trivially easy for hackers to intercept. To solve this massive security flaw, the Secure Shell (SSH) protocol was invented.
SSH creates a heavily encrypted, secure tunnel between your local computer and a remote Linux server. Once connected, every command you type and every response the server sends back is completely unreadable to anyone trying to intercept the traffic. Today, SSH is the absolute standard for remote server administration.
How to Connect Using SSH (Password Authentication)
The SSH client is built directly into the terminal of all modern operating systems (Linux, macOS, and Windows 10/11). You do not need to install any third-party software like PuTTY unless you are using a very old version of Windows.
To connect, you need three pieces of information: the username of the account on the remote server, the IP address (or domain name) of the server, and the password.
- Open your local Terminal (or Command Prompt in Windows).
- Type the
sshcommand using the following syntax:ssh username@ip_address - For example, if your username is “admin” and the server’s IP is “192.168.1.50”, you would type:
ssh [email protected] - Press Enter.
The First Connection Warning
The very first time you connect to a new server, SSH will pause and display a warning that looks like this:
“The authenticity of host ‘192.168.1.50’ can’t be established. ECDSA key fingerprint is SHA256… Are you sure you want to continue connecting (yes/no)?”
This is a security feature to ensure you are connecting to the correct machine. Type yes and press Enter. SSH will permanently save the server’s fingerprint to your computer so it will not ask again.
Finally, it will prompt you for the password. Note: As you type your password, nothing will appear on the screen—no dots, no stars. This is a Linux security feature. Just type it carefully and press Enter.
If successful, your terminal prompt will change to reflect the remote server’s name, meaning you are now controlling the remote machine.
Using a Custom Port (-p)
By default, SSH always attempts to connect over port 22. Because port 22 is so well known, hackers constantly run automated scripts to try and break into it. Many system administrators change the SSH port to a random number (like 2222) to avoid these automated attacks.
If your server uses a custom port, the standard SSH command will fail. You must explicitly tell the command which port to use by adding the uppercase -p flag.
ssh -p 2222 [email protected]
Advanced Security: SSH Keys
While passwords are fine for casual use, they can be brute-forced (guessed by a computer). For absolute security, industry professionals use SSH Key Pairs instead of passwords.
An SSH Key Pair consists of two incredibly long strings of cryptographic text: a “Private Key” (which stays safely on your local laptop) and a “Public Key” (which you place on the remote server).
When you attempt to connect, the server challenges your laptop to solve a mathematical puzzle using the Private Key. If it succeeds, you are logged in instantly without ever typing a password.
How to Generate an SSH Key
- On your local computer, open the terminal and type:
ssh-keygen -t rsa -b 4096 - Press Enter to accept the default file location.
- You will be prompted to enter a “passphrase”. This is an optional password to protect your private key. You can leave it blank and press Enter, or type one for maximum security.
- Your keys are now generated. To copy the public key to your remote server, use the
ssh-copy-idcommand:ssh-copy-id [email protected]
Once copied, the next time you type ssh [email protected], you will be logged in securely and immediately, completely bypassing the password prompt.