SSH key generation, SSH key update , SSH login without prompting password everytime
In local Server
$ ssh-keygen -t dsa -b 2048
This will create the two files:
.ssh/id_dsa (Private key)
.ssh/id_dsa.pub (Public key you can share)
Next insert ".ssh/id_dsa.pub" on the remote server in the file ".ssh/authorized_keys" and ".ssh/authorized_keys2"
Change the permission of each file to (chmod 600).
Make sure the directory ".ssh" exists on the remote computer with 700 rights.
Ok, assuming 192.168.1.155 is the remote server and "chumma" is the account on that remote server.
$ ssh chumma@192.168.1.155 "mkdir -p .ssh"
$ ssh chumma@192.168.1.155 "chmod 700 .ssh"
$ scp ./.ssh/id_dsa.pub chumma@192.168.1.155:.ssh/newkey.pub
Now connect to that remote server "192.168.1.155" and add .ssh/newkey.pub
to both "authorized_keys" and "authorized_keys2". When done, the permission
on
(This is on the remote server)
$chmod 600 .ssh/authorized_key*
SSH login without prompting password everytime
Next, go back to the local server and issue the following:
$ ssh-agent $SHELL
$ ssh-add
The "ssh-add" will allow you to enter the passphrase and it will
save it for the current login session.
You don't have to enter a password when running "ssh-keygen" above. But,
remember anyone with root access can "su - " and then connect
to your computers. It's harder, however, not impossible, for root to do
this if you have a password.
No comments:
Post a Comment