How to setup passwordless login in Linux

Check for Existing SSH Keys

You may already have an SSH key pair generated on your machine. To see whether you have SSH keys on the system, run the command:

ls -al ~/.ssh/id_*.pub

Generate SSH Key Pair

1. The first thing you need to do is generate an SSH key pair on the machine you are currently working on.

command is:

ssh-keygen -t rsa

Upload Public Key Using the ssh-copy-id or SFTP/SSH with Cat Command.

Option 1. Using the ssh-copy-id Command

Connect to the remote server and use the ssh-copy-id command, The public key is then automatically copied into the .ssh/authorized_keys file.

ssh-copy-id command:

ssh-copy-ide [remote_username]@[server_ip_address]

Option 2. Using The sftp with cat command :

sftp [remote_username]@[server_ip_address]
sftp> cd .ssh
sftp> put id_rsa.pub

Now login remote server :
cd .ssh
cat id_rsa.pub >> authorized_keys

Option 3. Using SSH with cat command :

cat .ssh/id_rsa.pub | ssh [email protected] ‘cat >> .ssh/authorized_keys

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.

This site uses Akismet to reduce spam. Learn how your comment data is processed.