Is it possible to force SFTP to use the configured public key only and not to proceed to other authentication method like password auth on failure to authenticate using public key? the PasswordAuthentication no in sshd_config is not possible as the user is also being used during putty & winscp connection. Thank you in advance!
Thank you all for your replies. Instead of adjusting the sshd_config file. I just added the -oBatchMode=yes in the SFTP command in the shell script and I think it worked for me.
Yes, you can access with the public-key. But before accessing SFTP using public key we want to set "PasswordAuthentication=no" in the ssh configuration file "/etc/sshd/sshd_config" so that you cannot access via remote using the user password.
Change the relevant lines of /etc/ssh/sshd_config and/or add these at the end:
ChallengeResponseAuthentication no PasswordAuthentication no
These default to "no" anyway, but make sure these are not set to "yes".
GSSAPIAuthentication no HostbasedAuthentication no RhostsRSAAuthentication no