Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
This is a similar problem to that reported in bug 575203.
If sshd is started without using rc-scripts then it works, but if it is started with rc-scripts and enforcing is on, then you cannot login without a password, even if the public key is in authorized_keys.
Setting enforcing off enables it to work.
Comment 4Sebastian Koehler
2011-07-23 11:17:20 UTC
Can confirm that it public key login works when restorecon -R -v .ssh is used.
Comment 5Sebastian Koehler
2011-07-23 11:33:20 UTC
Here are some additional tests I've performed. .ssh/authorized_keys has been created using ssh-copy-id from a remote host. In enforcing mode, login is not possible until restorecon -R -v .ssh is involved.
[root@CentOS ~]# sestatus
SELinux status: enabled
SELinuxfs mount: /selinux
Current mode: enforcing
Mode from config file: enforcing
Policy version: 24
Policy from config file: targeted
[root@CentOS ~]# secon --file .ssh/authorized_keys
user: unconfined_u
role: object_r
type: admin_home_t
sensitivity: s0
clearance: s0
mls-range: s0
[root@CentOS ~]# restorecon -R -v .ssh
restorecon reset /root/.ssh context unconfined_u:object_r:admin_home_t:s0->system_u:object_r:home_ssh_t:s0
restorecon reset /root/.ssh/authorized_keys context unconfined_u:object_r:admin_home_t:s0->system_u:object_r:home_ssh_t:s0
[root@CentOS ~]# secon --file .ssh/authorized_keys
user: system_u
role: object_r
type: ssh_home_t
sensitivity: s0
clearance: s0
mls-range: s0
If I delete the .ssh directory and recreate it as mentioned above in permissive mode everything is working. The issue is related to the security context of the files created by sshd.
[root@CentOS ~]# sestatus
SELinux status: enabled
SELinuxfs mount: /selinux
Current mode: permissive
Mode from config file: permissive
Policy version: 24
Policy from config file: targeted
[root@CentOS ~]# secon --file .ssh/authorized_keys
user: unconfined_u
role: object_r
type: admin_home_t
sensitivity: s0
clearance: s0
mls-range: s0