0

i have generated rsa key and add it to server's ~/.ssh/authored_keys.

why i nedd password when i ssh server?

my local name is A and server name is B(a root user).do i need create a user named A?

2
  • It's not entirely clear to me from your whether you're being asked for the RSA key's passphrase or for the password for the remote user. Being asked for the passphrase (once per session) is entirely usual.
    – RAOF
    Dec 21, 2012 at 6:32
  • password, not passphrase
    – jungledrum
    Dec 21, 2012 at 8:02

2 Answers 2

1

Although the question is not entirely clear, I suspect that the answer is that you've authorised the key for the wrong user.

When you say you added the key to ~/.ssh/authorized_keys that means the key is valid only to log in for that user (whichever it may have been). So, if you were logged in as userA that means that key will be used only if you try and log in as userA again, but won't be used if you try and log in as userB.

By default ssh will log you in as the remote user with the same name as your local user. So, if you're logged in to the local system as userA, ssh will try to log you in to the remote system as userA. If you need to log in as userB you can use ssh [email protected] rather than ssh my.server.net.

2
  • thank you!I create userA on server,it's ok.I don't know why.But I want log in as userB.
    – jungledrum
    Dec 21, 2012 at 8:03
  • Then use ssh [email protected] rather than ssh my.server.net, as I said? Or you can set the default remote user for that server in ssh_config.
    – RAOF
    Dec 21, 2012 at 9:20
1

You need password to Unlock generated keys. It requires only first time when you want use SSH. Then for a specific session no need to enter password.

(from man pages)

When the user logs in, the ssh program tells the server which key pair it would like to use for authentication. The server checks if this key is permitted, and if so, sends the user (actually the ssh program running on behalf of the user) a challenge, a random number, encrypted by the user's public key. The challenge can only be decrypted using the proper private key. The user's client then decrypts the challenge using the private key, proving that he/she knows the private key but without disclosing it to the server.

1
  • every time ,not first time.:-)
    – jungledrum
    Dec 21, 2012 at 5:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .