But sometimes typing password repeatedly for establishing a SSH connection with the trusted end machine is quite daunting task.
Let us see how to automate the things in 3 simple steps where we can ssh to "user@host" without asking a password every time. Replace user with the username and host with the remote machine ip-address or hostname. For E.g. firstname.lastname@example.org
NOTE: Only do this with trusted machines.
- Login to your local machine from which you want to ssh to remote machine. Go to your .ssh folder.
- Check if you have a 'id_rsa.pub' (or 'id_dsa.pub') file in .ssh folder. If not, try below command:
- Run ssh-copy-id
ssh-keygen -t rsa
To make it simple just keep on pressing the ENTER key a bunch of times, even when it asks for a password.
ssh-copy-id -i id_rsa.pub user@hostIf it asks for remote machine password then provide it so that it can create a security key successfully so that you dont need to remember password everytime.
Its done .. Now you can ssh to user@host without being prompted for password.