简体   繁体   中英

SSH Connection from server to another one without private key passphrase

I'm trying to set up an ssh connection from ServerA to ServerB without password, and the ssh connection keeps asking me for the passphrase of my private key.

Here is my configuration:

ServerA

The /home/user/.ssh folder has a CHMOD: rwx------ , and is owned by user:user

The files /home/user/.ssh/id_rsa.pub and /home/user/.ssh/id_rsa have a CHMOD: -rw------- and are owend by user:user

ServerB

I created a user serverA on the ServerB. The folder /home/serverA/.ssh has a CHMOD: drwx------ and is owned by serverA:serverA

The file /home/serverA/.ssh/authorized_keys contains the public key of the user on the ServerA, and has a CHMOD: -rw-r-----

In the file /etc/ssh/sshd_config I added the following lines:

RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys

However, when I am on ServerA and I try to type: ssh ServerA@ServerB, it asks me for the passphrase of my private key. When I give it, I get connected.

Do you know how I could do to avoid typing the passphrase of ServerA every time?

When you run ssh-keygen, you must have given the certificate a pass phrase. To not have to enter a pass phrase just press enter on that question to set an empty one when.

You can use ssh-agent , which will "remember" your passphrase for specified time. In short:

eval `ssh-agent` # start ssh-agent
ssh-add /path/to/your.key # remeber the key
ssh ServerA@ServerB  # will not ask for a passphrase

for more information, check more questions about ssh-agent or its manual page.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM