How to Connect to a Linux Server Using SSH
SSH (Secure Shell) is a protocol used to securely connect to remote Linux servers. This guide will show you the basic steps.
Requirements
-
A Linux server with SSH enabled
-
Server IP address or hostname
-
Username and password (or SSH key)
-
An SSH client (Linux/macOS: Terminal, Windows: PowerShell, Terminal, or a third party program like PuTTY)
Steps to Connect
1. Open your terminal or SSH client
On Linux or macOS, open the Terminal. On Windows, open PowerShell or terminal, or use an SSH client like PuTTY.
2. Use the SSH command
In the terminal, type:
Replace username with your server username, and server_ip with your server's IP address or hostname.
3. Accept the server key
The first time you connect, you'll see a message asking if you want to trust the server. Type yes and press Enter.
4. Enter your password
Type your password and press Enter. (Note: the password will not be displayed for security reasons.)
5. Successful connection
If your credentials are correct, you will be logged in and see the server's command prompt.
Optional: Using SSH Keys
For a more secure and convenient connection, you can use SSH keys instead of a password. Generate a key pair using:
Then copy the public key to the server:
Troubleshooting
-
Connection refused: Make sure the SSH service is running on the server.
-
Permission denied: Check your username, password, or SSH key.
-
Firewall issues: Ensure port 22 (default SSH port) is open.
That's it! You are now ready to securely connect to your Linux server using SSH.


