How to SFTP without prompting password?

I am using ubuntu (release 4.15.0-72-generic).

I have written multiple shell scripts to connect to a destination Linux server using sftp. But sftp is prompting me for a password.

Is there any way to stop the prompt without using sshpass/rsa key configuration?

1 Answer

Generally it's the best practice to have a password for SFTP users.

But still if you have to enable the password less authentication please follow the below steps:

I have followed as:

SSH Client : 192.168.0.12 ( RHEL ) SSH Remote Host : 192.168.0.11 ( AML ) 

Step 1: Create Authentication SSH-Keygen Keys on – (192.168.0.12)

ssh-keygen -t rsa 

Step 2: Create .ssh Directory on – 192.168.0.11

ssh sheena@192.168.0.11 mkdir -p .ssh 

Step 3: Upload Generated Public Keys to – 192.168.0.11

cat .ssh/id_rsa.pub | ssh user1@192.168.0.11 'cat >> .ssh/authorized_keys' 

Step 4: Set Permissions on – 192.168.0.11

ssh user1@192.168.0.11 "chmod 700 .ssh; chmod 600 .ssh/authorized_keys" 

Step 5: Login from 192.168.0.12 to 192.168.0.11 Server without Password

ssh user1@192.168.0.11 

Hope this helps.

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like