My user account is user1 at local. I am trying to sftp to a remote server using account user2 with sftp user2@remote using a private key. Does sftp use the id_rsa in ~user1/.ssh/? Or ~user2/.ssh/? Or something else?


Private key from local user on local machine (user1). Public key of user2@remotehost

Edit for more info - you can also specify which identity file to use when making the connection -

ssh -i /path/to/private/key user2@remotehost

In this case, whichever user you are on your local machine has to be able to read/access the private key you are referencing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.