If you need to connect to a Linux server remotely, one of the most popular and straightforward tools to use is PuTTY. PuTTY is a free and open-source terminal emulator that supports various network protocols, including SSH (Secure Shell), which is the most secure and widely used method for remote access to Linux servers.

In this blog post, we’ll guide you through the steps on how to use PuTTY to connect to a Linux server via SSH.

Step-by-Step Guide to Using PuTTY for SSH

Step 1: Download and Install PuTTY

  • Go to the official PuTTY website: https://www.putty.org.
  • Download the appropriate version for your system (32-bit or 64-bit Windows).
  • Once downloaded, install PuTTY by following the installation instructions.

Step 2: Gather Your SSH Connection Information

Before connecting to the Linux server, ensure you have the following information:

  • Hostname or IP address: The public IP address or hostname of your Linux server.
  • Port number: SSH typically uses port 22 by default unless it’s configured otherwise.
  • Username: The user account you’ll be logging into on the server.
  • Password or SSH Key: You’ll need either the user’s password or an SSH key for authentication.

Step 3: Open PuTTY and Configure the Connection

Once you have installed PuTTY and gathered the connection information, follow these steps:

  1. Open PuTTY: Launch the PuTTY program from your Windows start menu.
  2. Enter the Hostname (or IP Address):
    • In the Session category, you’ll see a field labeled Host Name (or IP address).
    • Enter the IP address or hostname of your Linux server. For example, it might look like: 192.168.1.100 or myserver.example.com
  3. Set the Port:
    • In the Port field just below, enter the port number (usually 22 for SSH).
  4. Connection Type:
    • Make sure SSH is selected as the connection type (this should be selected by default when you enter port 22).
  5. Save the Session (Optional):
    • To save your connection settings, enter a name in the Saved Sessions field (e.g., “MyServer”) and click Save. This will allow you to quickly access the server next time without re-entering all the information.

Step 4: Start the SSH Connection

Now that your connection details are set:

  1. Click on Open at the bottom of the PuTTY window.
  2. A terminal window will open, and you may see a security alert stating:
    “The server’s host key is not cached in the registry.”
    • This is normal the first time you connect to a server. Review the fingerprint, and if it matches the server’s SSH key, click Yes to proceed.

Step 5: Login to the Server

Once connected:

  1. You’ll see a prompt asking for a username. Type the username for your server and press Enter.
  2. Next, you’ll be prompted for your password (unless using SSH key authentication).
    • Note: For security reasons, you won’t see the cursor move or any asterisks when typing your password. Just type it and press Enter.
  3. If the credentials are correct, you’ll now be logged into your Linux server and see the command-line prompt.

Step 6: Using the SSH Session

Now that you’re logged into your Linux server, you can execute commands as if you were physically at the server.

Some common commands you may use include:

  • ls: List directory contents.
  • cd: Change directories.
  • sudo: Run commands with superuser privileges.
  • exit: Log out of the SSH session.

Step 7: Disconnecting the Session

When you are done working on the server, you can simply type exit in the terminal to close the SSH session:

exit

This will end the connection and close the PuTTY terminal.


Tips for Using PuTTY

  1. Using SSH Keys:
    • For better security, it’s recommended to use SSH key-based authentication instead of a password.
    • You can generate an SSH key pair using PuTTYgen (another tool from PuTTY) and then configure your Linux server to accept the SSH public key for login.
  2. Customizing the PuTTY Terminal:
    • In PuTTY’s Window and Appearance settings, you can adjust the font size, colors, and window behavior to your preference.
  3. Logging and Session Management:
    • Under the Logging option in the PuTTY settings, you can enable session logging, which might be helpful for tracking session activities.
  4. Reconnecting to the Server:
    • If you saved your session settings earlier, simply open PuTTY, click on your saved session, and click Load followed by Open to reconnect instantly.

Conclusion

PuTTY is a lightweight, yet powerful tool for connecting to Linux servers via SSH, especially for users on Windows systems. With the steps outlined above, you can quickly establish a secure connection, manage your server, and execute commands remotely.

For advanced users, you can further explore additional features like key-based authentication, tunneling, and session logging to enhance your workflow.

Happy SSHing!

Posted by in Blog on October 17, 2024 |