Skip to content

SSH Without Password

francisyzy edited this page Sep 5, 2021 · 1 revision

Have a password that is too long and annoying to type out every time you want to SSH or SCP into the UNIX servers? This is the solution for you!

PS you need to do it for every system you intend to set up SSH without password

Pre-requisites

  1. SOC Unix Account
  2. SSH client

Steps

Step 0

Make sure you can SSH into a server by trying to connect to one of the SOC servers eg stu.comp.nus.edu.sg

Step 1

cd ~/.ssh

ssh-keygen

This generates a RSA public/private key pair in the .ssh folder

Name the file something you can recognize in this example will name it stuKey

Step 2

Register the private key in your system

eval "$(ssh-agent -s)"

ssh-add ~/.ssh/stuKey

stuKey is the name of the key pair in this example

Step 3

Copy the public key into the server

Make sure you are still in the ~/.ssh directory

ssh-copy-id -i stuKey.pub XXXX@stu.comp.nus.edu.sg

Where XXXX is your UNIX username and stu.comp.nus.edu.sg is the server you are adding the key to

You will need to enter your password one last time 🤞

Step 4

Try out ssh without password

ssh XXXX@stu.comp.nus.edu.sg

Further enhancement

Add an SSH Config to further reduce the amount of keystrokes to enter to SSH

References

PragmaticLinux. (2021, May 20). Configure ssh for login without a password. PragmaticLinux. https://www.pragmaticlinux.com/2021/05/configure-ssh-for-login-without-a-password/.

Clone this wiki locally