Automatic Login For SSH/SFTP on Ubuntu

There are just three simple steps needed to automate your SSH/SFTP logins to remote Unix/Unix-like servers from your Ubuntu/Linux distribution, or an emulator on Windows like Cygwin.

1) Run ssh-keygen

abdullah@desktop:~$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/abdullah/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /home/abdullah/.ssh/id_rsa.
Your public key has been saved in /home/abdullah/.ssh/
The key fingerprint is:
06:23:fc:34:0f:12:40:b2:5e:7c:41:eb:4f:a2:ab:24 abdullah@desktop
The key's randomart image is:

Randomart image

2) Run ssh-copy-id <username>@<server-name>

abdullah@desktop:~$ ssh-copy-id's password: 
Now try logging into the machine, with "ssh ''", and check in:


to make sure we haven't added extra keys that you weren't expecting.

3) Login to your server using ssh

abdullah@desktop:~$ ssh ''
Welcome to!
Last login: Sun Sep 25 23:22:21 2011 from 

That’s all!

If you want a quick shortcut in the GUI, you could add a Custom Application Launcher to the panel with the ssh login command, as shown below:

Launcher Properties

Clicking the panel icon will directly open the terminal at the server with you logged in.

Note that this will also automate the login for SFTP, so you won’t need to type in your passwords there anymore too!

Leave a Reply

Your email address will not be published. Required fields are marked *