I am running a shell script as user A. In that script I need to execute a sftp that would transfer the file using another user B.
I am using the below command:
sftp -oPort22 B@remote server
However, I am getting password prompts each time.
I have done the following:
- Added the public contents from local server to remoter servers /home/<user>/.ssh/authorized_keys.
- Tried changing permission of .ssh directory to both 700 and 744. Also, tried changing permission of authorized_keys to both 600 and 644.
Nothing has worked so far.
I guess, the command I am passing is correct as sftp is happening; but the passwordless authorization not working may be due to some file permissions issues.
Need your inputs