Getting pam_selinux(sshd:session): Unable to get valid context for user through ssh when selinux is enabled

Solution Verified - Updated -

Issue

  • Getting Unable to get valid context for <user> warning when user logging in through ssh:

    ssh server1
    user1@server1's password:
    Unable to get valid context for user1
    Last login: Tue Aug 30 13:47:59 2019 from server2
    Connection to server1 closed.
    
  • This kind of message can be found in the /var/log/secure file:

    Aug 30 13:57:35 server1 sshd[1935]: pam_selinux(sshd:session): Unable to get valid context for user1
    

Environment

  • Red Hat Enterprise Linux 7
  • selinux
  • ssh

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content