1

First off, I want to say that I've tried everything in this question here, and it didn't help me: How to SSH to localhost without password?

I had a file permissions issue recently because I don't know how to Linux in which I typed chmod 700 -R /home, because I am a dumb. That might have something to do with my problem today. Someone helped me to fix that issue, but I thought I would bring it up because SSH is so stubborn about file permissions.

Here is SSH's verbose output log:

[user@centos ~]$ ssh -v localhost
OpenSSH_5.3p1, OpenSSL 1.0.1e-fips 11 Feb 2013
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to localhost [::1] port 22.
debug1: Connection established.
debug1: identity file /home/user/.ssh/identity type -1
debug1: identity file /home/user/.ssh/identity-cert type -1
debug1: identity file /home/user/.ssh/id_rsa type 1
debug1: identity file /home/user/.ssh/id_rsa-cert type -1
debug1: identity file /home/user/.ssh/id_dsa type 2
debug1: identity file /home/user/.ssh/id_dsa-cert type -1
debug1: identity file /home/user/.ssh/id_ecdsa type -1
debug1: identity file /home/user/.ssh/id_ecdsa-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3
debug1: match: OpenSSH_5.3 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.3
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host 'localhost' is known and matches the RSA host key.
debug1: Found key in /home/user/.ssh/known_hosts:7
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Next authentication method: gssapi-keyex
debug1: No valid Key exchange context
debug1: Next authentication method: gssapi-with-mic
debug1: Unspecified GSS failure.  Minor code may provide more information
Credentials cache file '/tmp/krb5cc_500' not found

debug1: Unspecified GSS failure.  Minor code may provide more information
Credentials cache file '/tmp/krb5cc_500' not found

debug1: Unspecified GSS failure.  Minor code may provide more information


debug1: Unspecified GSS failure.  Minor code may provide more information
Credentials cache file '/tmp/krb5cc_500' not found

debug1: Next authentication method: publickey
debug1: Trying private key: /home/user/.ssh/identity
debug1: Offering public key: /home/user/.ssh/id_rsa
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Offering public key: /home/user/.ssh/id_dsa
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Trying private key: /home/user/.ssh/id_ecdsa
debug1: Next authentication method: password
user@localhost's password: 

Here are the file permissions for the .ssh directory as well as its contents:

drwx------.  2 user user     4096 Jul  7 08:52 .ssh

drwx------.  2 user user 4096 Jul  7 08:52 .
drwxrwxr-x. 44 user user 4096 Jul  7 08:43 ..
-rw-------   1 user user 2183 Jul  7 08:52 authorized_keys
-rw-------   1 user user  672 Jul  7 08:52 id_dsa
-rw-r--r--   1 user user  603 Jul  7 08:52 id_dsa.pub
-rw-------.  1 user user 1675 Jul  2 10:55 id_rsa
-rw-r--r--.  1 user user  395 Jul  2 10:55 id_rsa.pub
-rw-r--r--   1 user user 2733 Jul  2 10:45 known_hosts

EDIT: Someone asked for the contents of /var/log/secure, so here they are. I removed my username, as it is my real name.

Jul  7 08:53:21 centos sshd[2611]: pam_unix(sshd:session): session opened for user *USERNAME REMOVED* by (uid=0)
Jul  7 08:55:25 centos sshd[2648]: Authentication refused: bad ownership or modes for directory /home/*USERNAME REMOVED*
Jul  7 08:55:25 centos sshd[2648]: Authentication refused: bad ownership or modes for directory /home/*USERNAME REMOVED*
Jul  7 08:56:59 centos sshd[2649]: Connection closed by ::1

Can someone help me?

0

1 Answer 1

2

You get the following error:

Authentication refused: bad ownership or modes for directory /home/USERNAME REMOVED

That would seem to imply (if you have left out only your user name) that you have the wrong permissions on your $HOME directory. On my system, I have:

  $ ls -lhd .
    drwxr-xr-x 104 myname myname 4.0K Jul  7 5:14 .

Do you have anything different?

Incidentally, the client log is pretty nigh useless, you should use the server log, since this is your very own pc. The easiest way is to stop the running ssh server, then issue, as sudo,

  # /usr/sbin/sshd -dD

which prevents ssh from daemonizing, and also increases the output to the debug level. Now, from a different terminal, try to ssh into localhost,

  $ ssh myname@localhost

and see the error messages appearing in the sshd terminal. That should help you, possibly more.

You must log in to answer this question.

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