29

I tried loggin into an SSH server via Nautilus' "Connect to Server" feature by just leaving the password blank, but that didn't work.

How do I connect to my server using the key I have on my system?

2
  • For ubuntu 14.04, see this answer
    – Ajoy
    Jul 1, 2015 at 10:53
  • For ubuntu 18.04 see this answer
    – Midhun KM
    Feb 13, 2019 at 9:12

7 Answers 7

24

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

2
  • I just tried this but receive 'Permission denied'. I can ssh in via the terminal, but only after I cd to the directory containing the key. Do I need to move the key somewhere else, or tell Nautilus where to find it somehow? Sep 7, 2013 at 21:27
  • 18
    Figured it out, finally. If the above answer doesn't work for you (seems to be a common problem for EC2 users) try ssh-add path/to/keyfile and try again. That fixed it instantly for me. Sep 17, 2013 at 21:03
17

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.

1
  • I had no idea you could use ssh hosts with Nautilus, just entering sftp://my-ec2 and having Nautilus just work is amazing. Combine that with Right Click -> "Open in Remote Terminal", and Nautilus is actually a pretty decent FTP/SSH client. Dec 1, 2022 at 23:27
12

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

ssh-add path

where path is the path of your .pem file.

2
  • 1
    yeah, this did work flawlessly!
    – umbe1987
    Aug 7, 2019 at 17:13
  • The best answer. thanks
    – Qudor Eng
    Jan 2, 2023 at 7:12
3

I had this issue when I stopped using Unity and switched to Gnome3 as my machine crawled along despite being way above spec with Unity.

Anyway, I first removed my ~/.ssh/known_hosts file to ensure it wasn't a fingerprint issue. It was not so I don't think this step was necessary.

I then tried (just for the hell of it as I'd tried everything else by now) entering my passPHRASE where it asked for my password. Lo and behold it worked.

1
  • Did you leave the user name field blank? Feb 17, 2012 at 11:54
2

For Ubuntu 14.04 LTS

The nautilus window has slightly changed.

Pre-requisites:

  1. Log in to the server.
  2. Add your public key to ~/.ssh/authorized_keys

Open nautilus on your local computer.

Log in using this URL format: ssh://user@server. To cd to anything other than your home patch, append with a slash. ssh://user@server/var/www for example.

2

I tried Sagun's approach, but the UI for connecting to server is different in 16.04. The command or argument required now is ssh://ssh_using_key.

2

For those who are using key.pem follow this its works for me:

change your key.pem file permission using:

sudo chmod 700 key.pem

and then add this to ~/.ssh/config (this file may not exist, if so then create it using 'cd ~/.ssh/' and then 'sudo nano config'):

Host my_server
HostName 111.0.0.1
User ubuntu
IdentityFile /home/user/somefolder/key.pem

111.0.0.1 is your server ip address, you can find it using this command:

ping mysite.com

and then try with Nautilus/File 'Connect to Server':

sftp://ubuntu@myserver/home
sftp://ubuntu@myserver/var/www
sftp://ubuntu@myserver/etc

You can change directory like this when you connect.

OR Alternatively easy way you can use 'Remmina Remote Desktop Client' built-in on Ubuntu, you can find it on Dashboard

Thanks.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .