I love the functionality for connecting to SSH sites to do secure file copies where it automatically mount the target but this only works with usernames passwords. Is it possible to use a private key file instead?
The functionality seems to missing from the connect to server menu in Nemo 1.1.2.
In my case I need to do something similar to WinSCP where I enter a private key to authenticate me with a gateway machine which then uses the supplied username to figure out which machine I am trying to connect to then creates an SSH tunnel to that machine.
Yes it's possible with the command line.
ssh-keygen -t rsa~/.ssh/id_rsa.pub.cat .ssh/id_rsa.pub | ssh username@target_host 'cat >> .ssh/authorized_keys'ssh username@target_hostI know it is possible using ssh directly on the command line but was hoping to do it through the gui.
this works perfectly already for me -- I use it every day :)
This works fine for me too, but it was not what I was asking for.
I was really looking for file manager type abilities to copy files to and from the remote server using a gui.
What i wanted was the ability to mount the remote machine file system like a drive in the same way that happens if you connect to an SSH server using nemo and the "Connect to Server" option from the file menu.
This is completely different from connecting to an SSH server to issue terminal commands using the method you describe.
@ashvince : are you sure your ssh keys are correctly set up ? I use authentication via ssh keys here in nemo and it works just fine.
Do I add the key passphrase in the password box or something? If so that is not made clear anywhere.
@ashvince : no. Setting up the keys must be done the same way as for connecting via command-line (ie the way grosdim described), and after that you will be prompted for the passphrase the first time you try to connect.
Ok, I have added my private SSH key (it was generated on a different machine) to my identities on this machine using ssh-add. Now when I try to connect I get an error message in an orange box at the top of the connect to server windows saying "SSH program unexpectedly exited" so still not joy.
To use a private key file with a specific host you should edit your local .ssh/config file.
To use an example, I have the following configured for GitHub:
Host github.com
User git
Hostname github.com
Port 22
PreferredAuthentications publickey
IdentityFile "~/.ssh/GitHub_OutsiderPerspective.openssh"
What this does is tell SSH to use these settings whenever connecting to the hostname github.com (unless they're overridden on the command line). This carries over to the SSH client in GVFS (which is what "Connect to server" in Nemo uses).
Nemo will connect successfully if the settings are valid - just enter your username and the host address (also port) and it will connect using the specified private key, or the default private key (id_rsa) to the remote machine.
If you were connecting to example.com as user and wanted to use a key file stored at say, /home/user/keyfile then you'd put the following in ~/.ssh/config :
Host example.com
User user
Hostname example.com
Port 22
PreferredAuthentications publickey
IdentityFile "/home/user/keyfile"
and then when connecting with Nemo enter the following:

And click connect - and you'll be connected. I recommend reading up on .ssh/config (try man ssh_config) since it's a powerful file to make SSH much nicer to use.
I guess in this context we could improve Nemo by letting you edit it directly from the GUI.
SSH config truly solves the problem! Just for information - while using encrypted private SSH key don't forget to write password for your key to "Password:" field.
@ashvince Is this solved? If yes, could you close the issue?
It's solved (e.g. connect to server with password and bookmark, later find no need to resupply password if keys are set up). I'd suggest closing this.
Most helpful comment
To use a private key file with a specific host you should edit your local .ssh/config file.
To use an example, I have the following configured for GitHub:
What this does is tell SSH to use these settings whenever connecting to the hostname github.com (unless they're overridden on the command line). This carries over to the SSH client in GVFS (which is what "Connect to server" in Nemo uses).
Nemo will connect successfully if the settings are valid - just enter your username and the host address (also port) and it will connect using the specified private key, or the default private key (id_rsa) to the remote machine.
If you were connecting to
example.comasuserand wanted to use a key file stored at say, /home/user/keyfile then you'd put the following in ~/.ssh/config :and then when connecting with Nemo enter the following:

And click connect - and you'll be connected. I recommend reading up on .ssh/config (try
man ssh_config) since it's a powerful file to make SSH much nicer to use.I guess in this context we could improve Nemo by letting you edit it directly from the GUI.