Transmit SFTP without entering login and password
Wednesday, September 27th, 2006In my previous entry regarding "SSH Login without entering password" I have wrote about how to make it easier to login into SSH servers.
It's all nice, works, and makes life easier. But if you are a Mac user who uses Transmit to log into SFTP servers, there is one very nice side-effect of the technique described in the forementioned entry. You can actually log into your SFTP servers by just typing a server's address, and with not need to enter password, or even login name!
Here's how I connect to my SFTP server:
And after clicking the Connect button…
Voila! No login name, and no password, but I was logged into a server which actually does require a login name, and the password is actually more than 10 characters!
How does it work? Well actually, SFTP connection is a connection using the same mechanism which is used to do an SSH connection (you use the same login and password for both). And Transmit uses the standard OS built-in functions to do this connection. Therefore, once you have set up your computer to be able to login into remote SSH server without entering password, you automatically gain ability to use Transmit to log into the same server using SFTP protocol!
There's one catch though. I have told you that you don't need to enter login name, but actually it is not true :) A name is required in order to login, but if you don't specify it, your current login name is used (which is "mike" in my case), and if login name on remote server is the same as your local one (and it happens that remote server's login name is "mike" too), you are just fine with the default values.
But what you are to do if, say, your local name is "mike", and you have setup an SSH key for, say, server "example.com" as "hosting@example.com" (ie, the user name on the remote hosting is "hosting", and not "mike)? Well, you can override the defaults, and specify which default name you want to use when connecting to which server. In order to do that, you have to edit contents of ~/.ssh/config file (you have to create it if it doesn't exist). For the case above, the contents of the ~/.ssh/config file should read
Host example.com
User hosting
This way, when you connect to the host "example.com" without specifying user name, the default user name "hosting" will be used (thanks to Dave Teare for this hint).
And of course, you can always just specify user name in the Transmit connection window :)
That's it :) Happy name-less and password-less SFTPing ;)

