1. Download and Install PuTTY
If you don't have PuTTY installed on your Windows machine, download it from the official website:
Once downloaded, run the installer and complete the installation process.
2. Open PuTTY
- Launch PuTTY by searching for it in your Start menu or by clicking on the shortcut.
3. Configure PuTTY for SSH Login
-
Enter the Hostname (VPS IP Address):
- In the PuTTY Configuration window, find the field labeled Host Name (or IP address).
- Enter the IP address of your VPS in this field (e.g.,
192.168.1.100
).
Example:
-
Set the Connection Type to SSH:
- By default, PuTTY should be set to SSH (you can confirm it is selected under the Connection Type section).
- Ensure the Port is set to 22 (unless your VPS uses a custom SSH port).
-
Optional: Save the Session (for future connections):
- In the Saved Sessions field, enter a name for your session (e.g., "MyVPS").
- Click Save. This will allow you to quickly load this configuration for future SSH logins without entering the details again.
4. Load SSH Key (If Using Key-Based Authentication)
If you're using SSH key-based authentication (recommended for security), you'll need to load your private key into PuTTY.
-
Convert your private key (if necessary):
-
If you're using an OpenSSH key (typically
id_rsa
), PuTTY doesn't accept this format directly. You'll need to convert it to PuTTY’s PPK format using PuTTYgen (a tool that comes with PuTTY). -
To convert:
- Open PuTTYgen (search for it in the Start menu or in the PuTTY folder).
- Click Load and select your existing private key file (e.g.,
id_rsa
). - Once the key is loaded, click Save private key to save the key as a PPK file (you can leave the passphrase empty if you don’t want a passphrase).
- Save it with a name like
my_vps_key.ppk
.
-
-
Load the PPK in PuTTY:
- In the PuTTY Configuration window, on the left pane, scroll down to Connection → SSH → Auth.
- Click Browse and select the PPK file you just saved.
5. Connect to the VPS
-
Click Open: After you've configured PuTTY, click the Open button at the bottom of the window.
-
First-Time Connection (If Applicable):
- The first time you connect to a new VPS, you may see a security warning about the server's host key not being cached in the registry. This is normal. Click Yes to proceed.
-
Login Prompt:
-
If using a password: After PuTTY connects, you'll be prompted for the username (e.g.,
root
) and then the password for that user. Enter the password and press Enter. -
If using SSH keys: If you’re using key-based authentication, the SSH key will automatically be used for authentication, and you won’t need to enter a password. You may be logged in directly, or in some cases, you may be prompted for a passphrase if you set one up for the SSH key.
-
6. Troubleshooting Common Issues
a. “Connection Refused” Error
- Make sure SSH is running on your VPS. If you're able to access the VPS via a web-based control panel (like from your VPS provider), check that SSH is enabled and running.
- Ensure the correct port (22) is open and accessible.
- Double-check that your VPS is connected to the internet.
b. “Access Denied” Error
- If you're getting an "Access Denied" message when using a password, ensure you’re entering the correct password for the specified username (e.g.,
root
or another user). - If using SSH keys, make sure the public key is correctly placed in the
~/.ssh/authorized_keys
file on the VPS.
c. “Server Host Key Not Cached”
- If you see a warning about the host key not being cached, this usually means it's your first time connecting to this VPS. If you're sure the VPS IP address is correct, click Yes to continue.
Thursday, January 30, 2025