I have a special scenario with SSH. I need to sftp a file with in the server for different user. Say I have User Scott in Server A who created a file. Now Scott needs to transfer the file to John who is also a user of Server A.
Here you may ask why don't you use cp command, but due to permissions of Destination folder we are unable to copy that file.
I tried with creating the id_rsa.pub file for Scott and appended to John's Authorized_keys. But still it is asking password while connecting.
To cross verify, I setup'ed a SSH connection from Server A to Server B. It is fine. Also tested the above mentioned scenario in another environment. It is also running fine.
We can't do SSH with in the server ? I don't think so (Correct me).
To my knowledge SSH/SFTP/SCP could be executed on a remote machine or between 2 hosts, it does not work within a same host/ip/machine. Though you have 2 users the server is the same, hence you need to use cp command. Since there is some permission issue while copying files, create a common directory where both the users can access the files and proceed further..
Both the users are from different groups. If I give permissions to Scott group then all others will also get. This directory actually contains important files and the permissions are set as 744, only John have complete access.