Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I cannot connect from my Windows 7 computer using PuTTy to a newly configured Debian Squeeze server using SSH RSA key authentication.

I get this error when running SSH in debug mode: User myuser authorized keys /home/myuser/.ssh/authorized_keys is not a regular file


What I've done so far:

  1. ssh-keygen -t rsa
  2. Set passphrase.
  3. Copied the id_rsa.pub file to ~/.ssh/authorized_keys
  4. Copied the id_rsa to a text file on my Windows 7 machine
  5. Imported the key into puttygen.exe and converted it to a .ppk private key file.
  6. Loaded that private key file into pageant.exe and made sure Connection->SSH->Auth Authetication methods had "Attempt authenticaiton using Pageant" checked.
  7. Loaded the profile.

Based off of the FAQ from OpenSSH.org, I changed the permissions to the following:

drwxr-xr-x 3 root   root   4096 Aug 13 14:16 /home
drwxr-xr-x 7 myuser myuser 4096 Aug 17 12:55 /home/myuser
drwx------ 3 myuser myuser 4096 Aug 17 13:24 /home/myuser/.ssh
drw------- 2 myuser myuser 4.0K Aug 17 13:23 /home/myuser/.ssh/authorized_keys
-rw------- 1 myuser myuser  396 Aug 17 13:17 /home/myuser/.ssh/authorized_keys/id_rsa.pub

I started debug mode on ssh, and got the following:

debug1: userauth-request for user myuser service ssh-connection method publickey
debug1: attempt 1 failures 0
debug1: test whether pkalg/pkblob are acceptable
debug1: Checking blacklist file /usr/share/ssh/blacklist.RSA-2048
debug1: Checking blacklist file /etc/ssh/blacklist.RSA-2048
debug1: temporarily_use_uid: 1000/1000 (e=0/0)
debug1: trying public key file /home/myuser/.ssh/authorized_keys
User myuser authorized keys /home/myuser/.ssh/authorized_keys is not a regular file
debug1: restore_uid: 0/0
Failed publickey for myuser from 10.1.1.1 port 50710 ssh2

I'm at a loss as to what else to check. I haven't setup SELinux or anything. Any ideas would be much appreciated.

share|improve this question

2 Answers 2

up vote 7 down vote accepted

The problem is:

User myuser authorized keys /home/myuser/.ssh/authorized_keys is not a regular file

It appears you've made a directory named authorized_keys and put all your key files in it. This is why it's not working. authorized_keys is meant to be a regular file, and you can put all your keys in ~/.ssh.

share|improve this answer
    
Wow... I'm having one of those days... Thanks! –  nojak Aug 17 '12 at 21:48

The main problem is that ~/.ssh/authorized_keys should not be a directory. It is a text file that contains the public keys appended one line after the other.

Since you only have one key, simply move out the ~/.ssh/authorized_keys/id_rsa.pub file to a temporary location, delete the ~/.ssh/authorized_keys directory, then move back the public key file by renaming it to ~/.ssh/authorized_keys. You should now be able to connect without using a login password.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.