1

I have a centos server s1 and client c1 and I wanted to do a lftp connection with sftp and ssh-key without the password been prompted. Currently when I run the below command the password is prompted even if I have a valid private key mentioned in the lftp command

lftp sftp://centos@ipaddress -e 'set sftp:auto-confirm yes; set sftp:connect-program "ssh -a -x -o StrictHostKeyChecking=no -i /home/centos/ftp-clientloc/id-rsa"; ls'

From the client side I did the following checks

Tried ssh connection to server with ssh-key and it worked without any password prompted Tried sftp connection to server with ssh-key and it worked without any password prompted Tried lftp connection with sftp and ssh-key , the password is asked and on pressing control + C it stills connects to the server successfully. Server side

PubkeyAuthentication is set to yes in /etc/ssh/sshd_config. PasswordAuthentication no UsePAM no restart the SSH service. How to get rid of the password prompt when connecting with lftp?

New contributor
JCDani is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

1 Answer 1

0

I was able to fix the issue by modifying the command lftp -e 'set sftp:connect-program "ssh -a -x -o StrictHostKeyChecking=no -i /home/centos/ftp-clientloc/id-rsa user@hostname"'.

This is what I believe that is happening with the command in the question, when the sftp://centos@ipaddress is given as lftp url that get executed first prompting the password then later executing the ssh command. On providing the host and user in the ssh command in the sftp:connect-program the issue is resolved and more readable

New contributor
JCDani is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .