Question: The Openssh ssh and scp command provied an `-i` command line option to specify the path to the RSA/DSA key to be used for authentication.

Looking at the sftp man pages I was not able to find a way to specify the RSA/DSA key.

I am looking for a way to do initiate an sftp session that will use a specified RSA/DSA key, and not the ~/.ssh/id\_{dsa,rsa} keys.

I tried OpenSSH sftp client on Linux...but it should have the same options on other platforms.

Answer: 
One potential option is to use `sftp -oIdentityFile=/path/to/private/keyfile`. Need more info to say whether that will work for you. Seems to work under Mac/Linux.
You can create an alternate config file for the connection and use the `-F` switch to tell ssh to use it. create a config file e.g. ~/.ssh/config.sftp with the contents

```
Host remote.host.tld
User RemoteUserName
IdentityFile /path/to/atlernate/identityfile

```

then call sftp like so

```
sftp -F ~/.ssh/config.sftp remote.host.tld
Connecting to remote.host.tld...
Enter passphrase for key '/path/to/atlernate/identityfile':
sftp>

```

The config above restricts the use of the alternate key (when this config file is used) to user RemoteUserName on remote.host.tld.

Have a look at the man page for [ssh\_confg](http://linux.die.net/man/5/ssh_config) for the usage of the alternate config file