How to generate RSA key Pair for sftp access without password authentication

This blog post will teach you how to generate RSA key pair and use it to access an SFTP server without having to enter a password.

Step 1.  Generate RSA key pair and verify that the keys are there.

Go to location
#cd /root/.ssh/

 Generate rsa key

ssh-keygen -t rsa

 As shown in below image

Generate RSA key Pair for sftp access

Two files has been created.

id_rsa and id_rsa.pub

Generate RSA key Pair for sftp access

Copy pub key to Remote server from client.

#scp -pv id_rsa.pub root@192.168.10.22:/root/.ssh/

Generate RSA key Pair for sftp access

Step 2 : Login to Remote server

And authorized the public key into authorized key file.

Enter the location

#cd /root/.ssh/

Generate RSA key Pair for sftp access

Add public key into authorized key file.

#cat id_rsa.pub >> authorized_keys            

As shown in below image.

Generate RSA key Pair for sftp access

Login to Client Computer

Now you can connect SFTP without password authentication.

#sftp -i id_rsa root@192.168.10.22:/swdump

As shown in below image.

Generate RSA key Pair for sftp access

Leave a Comment