Instead of doing:
[user@localhost ~]$: ssh remotename@remote.subdomain.domain.tld
remotename@remote.subdomain.domain.tld's password: ************
[remoteusername@remote ~]$:
We can do just:
[user@localhost ~]$: ssh remote
[remoteusername@remote ~]$:
And still have all the security provided by ssh. This is how:
First, create an asymmetric key pair.
[user@localhost ~]$: ssh-keygen -b 4096
That's right, 4096 bit key. Just because we can. The we create a configuration file for the destination server (the one we want to log to):
[user@localhost ~]$: $EDITOR ~/.ssh/config
Host SHORT_NAME_FOR_REMOTE_HOST*
User USERNAME_ON_REMOTE_HOST
Hostname FULL_NAME_OF_REMOTE_HOST.DOMAIN.TLD
Then we copy the public portion of the key to the remote host.
[user@localhost ~]$: scp ~/.ssh/id_rsa.pub SHORT_NAME:~/.ssh/authorized_keys
Of course, if the file already exists on the remote host we should copy our file to a temporal place, then log in the host and append it to the original with 'cat tempfile >> ~/.ssh/authorized_keys'.
Last step: log in without effort!
No comments:
Post a Comment