To pass custom private key (custom identity file, rather than the default one from .ssh directory) when connection via sftp, use the following command:  
sftp -v -oIdentityFile=/path/to/custom/.ssh/id_rsa
The “-v” option will print out verbose debugging information, “-o” allows us to pass ssh options, in this case we pass “IdentityFile” with value “/path/to/custom/.ssh/id_rsa”.

Leave a Reply

Your email address will not be published. Required fields are marked *