Logging in Using SSH
Last updated
Last updated
This section will show you how to connect to a Linux Server using Secure Shell (SSH)
To connect via SSH, you’ll need an SSH client. Here are some recommended options:
For Windows:
: 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):
: Provides a robust environment with direct SSH support.
MobaXterm (Windows only): A multipurpose tool with built-in SSH, SFTP, and more.
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.
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.
Open the terminal on your device.
Enter the following command, replacing [username]
and [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.
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.
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.
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!