Ssh to remote server without password in Ubuntu
This post was written by admin on April 11, 2009
Posted Under: Security
Posted Under: Security
1.Run the following command in you local hosts:
j@local:~$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/j/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/j/.ssh/id_rsa.
Your public key has been saved in /home/j/.ssh/id_rsa.pub.
The key fingerprint is:
bc:8b:75:13:5a:d7:2e:99:01:5b:8f:8f:26:90:7a:69 j@local
The key's randomart image is:
+--[ RSA 2048]----+
| |
| |
| . . |
| . . + + |
| S + + o |
| . * o B |
| . E + * o |
| = o + . |
| . . |
+-----------------+
j@local:~$
2.Now check these is a file named id_rsa.pub under the .ssh directory
j@local:~$ cd .ssh
j@local:~/.ssh$ ls
id_rsa id_rsa.pub known_hosts
j@local:~/.ssh$ cat id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAo454ZX8aTUkOHnmKfx2tAJQN6v/eg1TmpeK1gNij7Bqj0SzX/
Dpic94vzDZOus0KIhAZE4A88tfeiQjc62gj/1QDiEWfu7BRjZuWwoopGPYRmBcfyj+r2o7qyl+v33FYiJu2ix
JlJeLnSW0Vjp9jqG8WbOnz8JXPKYTzxvc62tzJOZ6GCI0xGP6Nu9qRKGWQa3w6u5wLYpbQNfRhUvxTlzjObxe
dbytK6Rdj8FSb+y5a05swJGP4oOHaoloN3RzSEPnRR4I9PBWidupnsyTAlO5DAJiJqNbPFugZ3p6ffKdVp5RG
FZ0wJnlDMGAAEXAaMqAyfZIPx6IAp53Y3mHCaw== j@local
j@local:~/.ssh$
3.Login to the remote server,then run the following command:
[j@remote ~]$ mkdir .ssh
[j@remote ~]$ cd .ssh
[j@remote .ssh]$vi authorized_key
Then copy to content of id_rsa.pub in step 2 to this file.
4.Done,now you can ssh to this remote server without password in your ubuntu.
Related posts:
- ssh to remote host without password
- An Easy way to mount remote filesystem on ubuntu
- Install PAC Manager – Manage Remote Connections in Ubuntu 11.10
- Allow Remote Control to your desktop on ubuntu
- Remmina-free and open-source Remote Desktop Client written in GTK+

Reader Comments
Great post,thanks!
[Reply]
Or you can run ssh-copy-id -i id_rsa.pub users@machine, of course that’s after running ssh-keygen -t rsa on the local machine
[Reply]