2

I have set up my computer to do the public/private authentication with a remote server, but somehow it is not working today.

I have done the ssh key-gen -t rsa, then scp'd it to the remote.

I can scp without a password (using the pub/priv key), but whenever I try to SSH, it requests the password.

What can I do to authenticate on the key alone?

8
  • Does te server requires pass for the Key or for your username? (Should be indicated : pass for key xxx)
    – M'vy
    May 14, 2011 at 16:28
  • Where/How would I check this?
    – pureman
    May 14, 2011 at 16:30
  • Does the prompt only says : Password: or something like Enter passphrase for key '/home/xxx'
    – M'vy
    May 14, 2011 at 16:31
  • Oh, it asks for "user@remote's password," so the username.
    – pureman
    May 14, 2011 at 16:34
  • What does ssh -v ... say? It mostly shows you where the problem is. Also, show us ls -la ~/.ssh.
    – slhck
    May 14, 2011 at 16:55

4 Answers 4

6

You should check if you have (sshd_config) :

RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile      %h/.ssh/authorized_keys

UsePAM yes  <-- That one is usually the last line of the sshd_config

Then that your public key is added to authorized_keys in your ~/.ssh/. The last one (UsePAM yes) is very important, since if disabled it will force you to authenticate with your unix account. PAM is here to say that private key authentication is sufficient to log in. Eventually, if that still don't resolves you may have to check the PAM configuration.

3
  • 2
    I think working scp illustrates that the proble is on the client side, not on the server's one.
    – Basilevs
    May 14, 2011 at 16:39
  • UsePAM is "yes" and everything in my pam.conf file is commented out. Any more help would be greatly appreciated.
    – pureman
    May 14, 2011 at 16:43
  • Do you specify the key manually with -i ? or with a directive in .ssh/config? Do you have a pam_sshd or pam_ssh in the /etc/pam.d/ directory? What are you using for ssh and scp client: command line? GUI? Linux/Windows?
    – M'vy
    May 15, 2011 at 11:40
1

You need to add your public key on the server to the authorized keys:

ssh-keygen -i -f keyfilename.pub >> ~/.ssh/authorized_keys2

or

cat keyfilename.pub >> ~/.ssh/authorized_keys2
1

First, On remote server:

/usr/sbin/sshd -de -p 1234

Second, On your computer:

ssh -vp 1234

You may find the error.

Or you can post them here.

0

If you can scp with the key but not ssh, it sounds like your scp client can find the key, but the ssh client can't.

Since you mentioned ssh-keygen -t rsa I'm going to assume that you're using OpenSSH on UNIX of some kind and you saved the key in the default location in some user account.

Are you logged in as user other than the one with the key (e.g. sued or sudoed) when you're running the ssh client? If you need to ssh without a password from that account also, you'll probably want to use ssh-keygen in that account, and then put that account's public ssh key in the remote server's authorized keys file along side the other one.

You must log in to answer this question.

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