Logging in Using SSH
This section will show you how to connect to a Linux Server using Secure Shell (SSH)
ℹ️ Required Applications
To connect via SSH, you’ll need an SSH client. Here are some recommended options:
For Windows:
PuTTY: A widely-used SSH client with a graphical interface.
Windows Command Prompt/PowerShell: Windows 10 and above include OpenSSH, so you can use
cmd
or PowerShell directly.Windows Terminal: An enhanced terminal with support for multiple profiles and SSH.
For macOS and Linux:
Terminal (Built-in): Both macOS and Linux have a built-in terminal with SSH capabilities.
For Cross-Platform (Windows, macOS, Linux):
Visual Studio Code (with Remote SSH extension): Provides a robust environment with direct SSH support.
MobaXterm (Windows only): A multipurpose tool with built-in SSH, SFTP, and more.
ℹ️ Prerequisites
Before starting, ensure you have:
The IP address or domain name of the server.
The username you’ll use to log in.
The password or SSH key for authentication.
📘 Step-by-Step Guide to Connect via SSH
Install and Open Your SSH Client
Windows: If you’re using PuTTY, download and install it. If you prefer the command line, you can use Command Prompt or PowerShell without additional installations.
macOS/Linux: Open Terminal (it’s pre-installed).
Visual Studio Code Users: Install the Remote - SSH extension from the Extensions Marketplace.
Connect Using SSH
Option A: Using Terminal/Command Line
Open the terminal on your device.
Enter the following command, replacing
[username]
and[server_ip]
:ssh [username]@[server_ip]
Example:
Enter the Password (if prompted):
If you’re using password-based authentication, you’ll be prompted to enter your password.
Using SSH Keys (Optional):
If you’ve set up SSH keys, ensure your public key (
~/.ssh/id_rsa.pub
) is added to the server’s~/.ssh/authorized_keys
file.The terminal will automatically use your SSH key if configured.
Option B: Using PuTTY (Windows Only)
Open PuTTY.
In the Host Name (or IP address) field, enter the server’s IP or domain.
Set the Port to
22
(the default SSH port).Click Open.
Login Prompt: When the terminal opens, enter your username, press Enter, then enter your password or use SSH keys as configured.
Option C: Using Visual Studio Code
Open Visual Studio Code.
Go to the Remote Explorer side panel, then click Connect to Host.
Enter your SSH command (e.g.,
ssh [username]@[server_ip]
).Enter your password or allow the SSH key if configured.
You’ll now have remote access directly from VS Code.
Verify Connection
You should now be logged into the server. You’ll see a command prompt indicating your connection, usually with the server’s hostname and the username you’re logged in as.
🔧 Troubleshooting Tips
Permission Denied: Ensure you have the correct username, IP, and password. Check that your SSH key is correctly added if using key authentication.
Connection Timeout: Verify the server is online, and the firewall isn’t blocking port
22
.Add to Known Hosts: On first connection, you may be prompted to accept the server’s fingerprint. Type
yes
to continue.
With these steps, you’ll be connected to your server using SSH!
Last updated