Posts Tagged ssh
SSH connections without password
Posted by Luis Gallardo in Linux on 13/02/2012

It’s likely you’ve worked in a remote server using ssh many times. Of course it increases the security by using a encrypted protocol, but it’s also true that by making several reiterative connections it can be tedious to enter the password over and over. With ssh you have the option to disable the password prompt by using just the public key of the client. Here you will learn how to do so.
WARNING: Bare in mind this can be a security risk, because if someone gain access to your local session on the ssh client, your account on the remote server will be compromised.
Generating the key
To generate the user’s public key on the client side, you must use ssh-keygen as shown next:
lgallard@moody:~$ ssh-keygen -t rsa -N '' Generating public/private rsa key pair. Enter file in which to save the key (/home/lgallard/.ssh/id_rsa): Your identification has been saved in /home/lgallard/.ssh/id_rsa. Your public key has been saved in /home/lgallard/.ssh/id_rsa.pub. The key fingerprint is: b0:53:cc:bd:44:cb:f8:39:81:5c:09:ae:66:1b:90:c8 lgallard@moody The key's randomart image is: +--[ RSA 2048]----+ | ..o. | | . . . = B.. | | E o . O * | | . = o + | | B S = | | o + . | | . | | | | | +-----------------+
Copying the key
You can use sshand the standard output to copy the public key on the remote server:
lgallard@moody:~$ cat .ssh/id_rsa.pub | ssh [email protected] 'cat - >> /home/lgallard/.ssh/authorized_keys'
How it works?
Easy, now whenever you connect to the ssh server, you won’t be prompted for password. The same will happen when copying files remotely with scp.
Reference: man ssh





Planeta Linux
Follow me