Key-based SSH login with Nautilus' "Connect to Server"

Instead of entering the username in the fields below, you'll have to prepend user@ to the server address and leave both username and password blank:

enter image description here


I needed to connect to EC2 instance using .pem key + connect using normal username-password mode. I solved these requirements by including the Host aliases in ~/.ssh/config file. Example:

Host ssh_using_key
HostName abc.myawesomesite.com
User ubuntu
IdentityFile ~/.ssh/MyPrivateKey.pem
Compression yes

Host ssh_using_userpass
HostName 173.193.72.103
User root
Port 2222

Now as described above, go to File > Connect to Server in Nautilus. Example:

For SSH using Key:

Server = ssh_using_key (as in the ~/.ssh/config file)
Type = SSH
Folder = /var/www
[leave User Details BLANK.]

For SSH using Username and Password:

Server = ssh_using_userpass (as in the ~/.ssh/config file)
Port = 2222
Type = SSH
Folder = /home/www
User name = root
Password = lamepassword
Check Remember this password.

Please modify this according to your need. Hope this helps someone.


As mentioned by Tom Brossman in one a comment, try this:

ssh-add path

where path is the path of your .pem file.

Tags:

Ssh

Nautilus