Getting password less login with SSH to work when all hope is lost.

Had access to two servers. On one I could login without password, on the second I could not.
No root access, not that it mattered in this case.

Googled a lot, and everybody told me to

chmod 700 .ssh
chmod 600 .ssh/authorized_keys

and it should work, still the computer said NO …

There was one more thing (!)

SELINUX

To really find out about SELINUX (ask Google)
Checking the SELINUX permissions
[asbjorn@server01 ~]$ ls -dZ .ssh .ssh/authorized_keys
drwx——. asbjorn users unconfined_u:object_r:home_root_t:s0 .ssh
-rw——-. asbjorn users unconfined_u:object_r:home_root_t:s0 .ssh/authorized_keys

debug1: Next authentication method: publickey
debug1: Offering public key: asbjorn@server00
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Trying private key: /home/asbjorn/.ssh/identity
debug1: Trying private key: /home/asbjorn/.ssh/id_rsa
debug1: Trying private key: /home/asbjorn/.ssh/id_dsa
debug1: Next authentication method: password
asbjorn@server01’s password:
debug1: Authentication succeeded (password).
chcon -t user_home_t .ssh .ssh/authorized_keys

[asbjorn@server01 ~]$ ls -dZ .ssh .ssh/authorized_keys
drwx——. asbjorn users unconfined_u:object_r:user_home_t:s0 .ssh
-rw——-. asbjorn users unconfined_u:object_r:user_home_t:s0 .ssh/authorized_keys

debug1: Next authentication method: publickey
debug1: Offering public key: asbjorn@server00
debug1: Server accepts key: pkalg ssh-rsa blen 277
debug1: Authentication succeeded (publickey).
Reference:
Security Enhanced Linux Contexts Labeling Files

 


Posted

in

by

Tags:

Comments

Leave a Reply