How to SFTP without prompting password?

7,171

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 [email protected] mkdir -p .ssh

Step 3: Upload Generated Public Keys to – 192.168.0.11

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

Step 4: Set Permissions on – 192.168.0.11

ssh [email protected] "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 [email protected]

Hope this helps.

Share:
7,171

Related videos on Youtube

Mahui
Author by

Mahui

Updated on September 18, 2022

Comments

  • Mahui
    Mahui over 1 year

    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?

  • Santosh Garole
    Santosh Garole about 4 years
    @Mahui if this works please accept the answer: meta.stackexchange.com/questions/5234/…