Secure Shell (SSH): A Comprehensive Guide to Secure Login


Secure computer network communication is essential in today's interconnected world to safeguard sensitive data and preserve system integrity. Secure Shell (SSH) is one of the most frequently used protocols for safe remote login and file transmission. SSH enables users to safely enter into distant computers by providing a secure and encrypted channel over an unsafe network. The use of SSH for login purposes, its advantages, and recommended practises for creating a secure connection will all be covered in this article.

Benefits of SSH

  • Strong encryption techniques are used by SSH to safeguard data transmissions between clients and servers, preventing unauthorised parties from intercepting and decrypting the data.
  • SSH offers a number of authentication techniques, such as passwords, public-key cryptography, and two-factor authentication, to make sure that only authorised users can access the distant system.
  • Secure File Transfer: SSH offers a secure method of exchanging files between systems utilising the Secure Copy (SCP) or Secure File Transfer Protocol (SFTP) in addition to login functionality.

Using SSH for Login: To utilize SSH for remote login, follow these steps:

Step 1. Install an SSH client Start by installing an SSH client on your local machine. Popular SSH clients include OpenSSH (available for most Unix-like systems), PuTTY (for Windows), and Terminal (for macOS by default).

Step 2. Generating a new SSH Key You can generate a new SSH key on your local machine. After you generate the key, you can add the public key to your account on  or any repo to enable authentication for Git operations over SSH. Type the below command on mac terminal.

ssh-keygen -t ed25519 -C "[email protected]"

Secure Shell (SSH)

Step 3. As in above change the file name to lovy_for_gitHub to differntiate the ssh keys genreated for which repo, in this case we are generating to connect with github profile. 

Step 4. We will let passphrase as emply , but we can add paraphrase to secure the key.

Secure Shell (SSH)

Step 5. The private and public keys for the ssh are generated under the folder as specefied (/Users/lovy/.ssh/) 

Your identification has been saved in /Users/lovy/.ssh/lovy_for_gitHub
Your public key has been saved in /Users/lovy/.ssh/

Step 6. Use the below command to view the file in the terminal or navigate at above location to open the file.

Secure Shell (SSH)

Step 7. After opening the file copy the content in clipboard and Navigate to your github profile and click on setting icon and SSH key on left navigation

Secure Shell (SSH)


Step 8. Add a name for ssh and paste the content copied here.

Secure Shell (SSH)

Step 9. Save the key and go to your terminal. Now we will add the identity file created to ssh.

Secure Shell (SSH)

Step 10. Post that you would be able to clone and work on any repo for that github profile.

Secure Shell (SSH)

Working with multiple SSH

The process enables you to manage multiple SSH keys and logins efficiently. It enhances security by associating unique keys with different hosts or accounts. By using SSH agent and configuring the SSH config file, you can conveniently switch between identities and simplify your SSH connections.

Step 1. Create a config file in .ssh folder and add the configuration for using multiple accounts

nano config

Secure Shell (SSH)

Step 2. Updated the configuration file like as shown below.

# Default github account
Host github-lovy
   IdentityFile ~/.ssh/lovy_for_gitHub
   IdentitiesOnly yes

# Other github account
Host github-lo
   IdentityFile ~/.ssh/lo_github_mac
   IdentitiesOnly yes

#For linux server at pre prod for pmh
Host preProdPmh
     User root
     Port 22
     IdentityFile ~/.ssh/laravel_pmh

As in above we have two configuration for github account and 1 for linux server added so we can simply connect with these using Host.

Step 3.  Now as below we are able to clone two diferent account of github using Host parameter specefied.

Secure Shell (SSH)


SSH (Secure Shell) over HTTPS (Hypertext Transfer Protocol Secure) offers several advantages in terms of ease of usage and security. SSH provides a secure and encrypted method for remote access and file transfers, while HTTPS ensures the secure transmission of data over the web.

Similar Articles