This one was a bit of a head-banger. I use ssh_config to cut down on typing when dealing with ssh & scp et al. My config file is pretty simple and a definition for one server might be like this:
Host KratosLAN User mbcdev HostName 192.168.1.10 Port 3421 IdentityFile ~/.ssh/id.rsa
This allows me to do cool stuff like just typing ‘ssh KratosLAN’ to connect to that server and have all of those settings applied.
I need to copy files to and from a lot of servers in work so I used the same idea when setting up lots of sftp bookmarks in nautilus / GNOME. Nautilus has a ‘connect to server’ dialogue where all I needed to do was to give the value for ‘Host’ and it would open the connection, respecting the other settings like username etc in the ssh config file.
The head-banging started when I was trying to set up the same thing on my home machine. No matter what I tried Gnome kept telling me that the server at the specified hostname was not found. This was bizarre because I could use ‘KratosLAN‘ in scp and ssh commands just fine. The solution became apparent when I tried entering this in nautilus by bringing up the location bar (ctrl+l) and typing:
Lo and behold I got a similar error message to the connect to server dialogue but this time I noticed that Nautilus had changed ‘KratosLAN’ to ‘kratoslan’. So, the lesson of the day is:
You’re allowed to have mixed case for your ‘Host’ values in your ssh config file but Nautilus won’t respect it. For maximum compatibility use only lowercase values for your Hosts.