SSH: What?, Why? and How to Use?

What?

SSH, acronym for Secure SHell, is a secure protocol for logging into a remote server/computer. It provides a secure encrypted connection between the client and the server. Remote servers can be accessed via SSH, allowing you to execute commands, download/upload files, and run computing jobs on the remote machine.

Why?

SSH ensures security and privacy through public-key cryptography and encryption, which reduces the possibility of data breaches and hacker attacks. When you initiate a connection from your laptop (SSH client) to a remote server (SSH server), SSH verifies the server's identity and encrypts all transmitted data.

How to Install SSH Client on Your Laptop

  • Prerequisites: Ensure that your computer has a terminal tool and the permissions to install software.
  • On Linux-based computers: Most Linux distros come with a terminal by default.
  • On Windows (version 10 and later): Use Windows PowerShell, which comes pre-installed.
  • For older versions of Windows: You can install Windows Terminal from the Microsoft Store.
  • SSH Client Installation: SSH client is likely pre-installed. If not, follow the instructions below:
  • For Windows: Go to Settings > System > Optional Features > OpenSSH Client, and click Add.
  • For Linux: Open a terminal and use the following commands depending on your OS:
    • Ubuntu: apt install openssh-client
    • AlmaLinux: dnf install openssh-client
    • Red Hat: yum install openssh-client

SSH Key Pair Authentication

  • SSH Key Pair Authentication applies to all SSH clients. It involves generating a Key Pair, typically using the RSA or DSA algorithm.
  • To generate a Key Pair, run the following command in your terminal:
    • ssh-keygen -t rsa -b 4096
    • When prompted to "Enter file in which to save the key," simply press Enter to accept the default file location. This will store the key in the standard directory (~/.ssh/id_rsa for Linux/macOS or C:\Users\username\.ssh\id_rsa for Windows).
    • Next, you will be asked to enter a passphrase. This step is optional but recommended for added security. If you choose to set a passphrase, type it in (note that nothing will appear as you type) and press Enter. Otherwise, just press Enter again to leave it blank.
    • After confirming the passphrase (or skipping it), your SSH key pair will be generated, and the system will display the key's fingerprint and a randomart image as confirmation.

How to Connect via SSH

  • The public key from the Key Pair (id_rsa.pub) must be copied to the registration form. The default location of the file is:
    • username\.ssh\id_rsa.pub for Windows.
    • username/.ssh/id_rsa.pub for Linux-based systems.
  • To view the contents of the file, run:
    • Windows: cat ~\.ssh\id_rsa.pub
    • Linux: cat ~/.ssh/id_rsa.pub
  • To establish the SSH connection, use the following command:
  • ssh -i .ssh/id_rsa username@punchlogin.goegrid.gwdg.de
  • For more information, visit the GWDG Documentation Page.