0

I enabled the SELINUX again on my CentOS 8.2 installation. And now the logins wont work, neither by ssh or direct. To login i have to make the mode to permissive. the secure log shows as below.

#login with ssh

Sep 14 02:26:57 lcl sshd[4407]: Accepted password for <MY USERNAME> from <My local ip> port 52410 ssh2
Sep 14 02:26:57 lcl systemd[4412]: pam_unix(systemd-user:session): session opened for user <MY USERNAME> by (uid=0)
Sep 14 02:26:57 lcl sshd[4407]: pam_systemd(sshd:session): Failed to create session: Start job for unit user@1000.service failed with 'failed'
Sep 14 02:26:57 lcl sshd[4407]: pam_unix(sshd:session): session opened for user <MY USERNAME> by (uid=0)
Sep 14 02:26:57 lcl sshd[4421]: fatal: sshd_selinux_copy_context: setcon failed with Permission denied
Sep 14 02:26:57 lcl sshd[4407]: pam_unix(sshd:session): session closed for user <MY USERNAME>

#this is when i tried to login directly without ssh.

Sep 14 02:29:13 lcl systemd[3716]: pam_unix(systemd-user:session): session opened for user <MY USERNAME> by (uid=0)
Sep 14 02:29:13 lcl systemd[3721]: pam_unix(systemd-user:session): session closed for user <MY USERNAME>
Sep 14 02:29:13 lcl login[1225]: pam_systemd(login:session): Failed to create session: Start job for unit user@1000.service failed with 'failed'
Sep 14 02:29:13 lcl login[1225]: pam_unix(login:session): session opened for user <MY USERNAME> by LOGIN(uid=0)
Sep 14 02:29:14 lcl login[1225]: LOGIN ON tty1 BY <MY USERNAME>
Sep 14 02:29:14 lcl login[1225]: pam_unix(login:session): session closed for user <MY USERNAME>

I am not a hardcore server admin please help me fix this issue.

4
  • 1
    Check the audit log. – Michael Hampton Sep 14 '20 at 14:12
  • Audit log is too verbose and its like every second its updated so its hard to tell anything. Anyways i reinstalled and this time did not disabled the selinux as getting hang of selinux settings. :) – Vipin Jain Sep 15 '20 at 15:24
  • 1
    You can just look at log entries around the time of your login attempt. You don't need to look at everything. – Michael Hampton Sep 15 '20 at 19:12
  • Try using tail -10 /var/log/audit.log | audit2allow. The audit2allow command will convert the entries its sees to plain english explanations. Try the login attempt as per @MichaelHampton suggestion. @zorry's autorelabel suggestion also seems sound advice. – davey Oct 31 '20 at 15:21
2

Running with Selinux disabled for a long time can cause files to not be labelled or labelled with Selinux context not matching the installed policy. Also daemons and other processes (including systemd) could run with unexpected contexts.

Shortest way to get it to work, set it to enforcing in /etc/selinux/config, issue the following command:

touch /.autorelabel

Then reboot, you should be able to login now.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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