4

I just switched over from Kubuntu to Feodra KDE Spin. Now, I have an LVM setup where my home partition is on its own volume. I created a user with the same username as the one I had in the last distro. I was dismayed to find out that I couldn't log in. The screen just went blank, then I saw a blinking cursor, and then I was bounced back to the login screen. I tried to login from a tty, which worked, but I got this wonderful message:

-- user: /home/user: change directory failed: Permission denied

Okay. So I logged in as root and tried to chown everything back to user. Nothin' goin'. I chmoded my /home/user directory. Still nothing. I'm officially at a loss as to what I should try next, and I thought you fine folks might help. Here's some information for you:

id -u user 
1000

stat /home/user/
  File: '/home/user/'
  Size: 4096            Blocks: 8          IO Block: 4096   directory
Device: fd02h/64770d    Inode: 11272193    Links: 22
Access: (0700/drwx------)  Uid: ( 1000/user)   Gid: ( 1000/user)
Context: system_u:object_r:unlabeled_t:s0
Access: 2017-06-16 19:42:02.224062623 -0400
Modify: 2017-06-16 19:42:00.651082621 -0400
Change: 2017-06-16 19:42:00.651082621 -0400
 Birth: -

It all looks good to me, but what do I know? Strangely enough, when I am logged in as user, I can cd into that directory with no issues.

  • 2
    You might, as root, do restorecon -Rv /home. The context should be user_home_dir_t I believe. – KevinO Jun 17 '17 at 0:59
  • Do I really do that on /home or do I do it on /home/user? – 2-bits Jun 17 '17 at 1:08
  • 2
    The recursive (-R) parameter will update everything in /home. You can also specify /home/user if you believe other directories in /home are correct. Given that some directories in the user's home dir also have contexts (e.g., .ssh is ssh_home_t), I would keep the -R regardless. – KevinO Jun 17 '17 at 1:11
  • By jove, that did it. Write an answer and I'll accept it. I've never really messed with SE Linux, so I would probably have never ever guessed this would be a solution. – 2-bits Jun 17 '17 at 1:15
4

Based upon the OP's information (which, btw, was excellent for the question), the SELinux context was incorrect. In the OP's question, the Context showed as:

Context: system_u:object_r:unlabeled_t:s0

However, a home directory should have user_home_dir_t.

To resolve the situation, running restorecon -Rv /home (using /home ensures that home directories for other users are updated; one could fix just the particular users's home dire by restorecon -Rv /home/user) will adjust the situation. The result should be similar to:

File: ‘/home/user’
Size: 4096          Blocks: 8          IO Block: 4096   directory
Device: fd00h/64768d    Inode: 18642668    Links: 16
Access: (0700/drwx------)  Uid: ( 1000/ user)   Gid: ( 1000/ user)
Context: unconfined_u:object_r:user_home_dir_t:s0      <-- THE CONTEXT
Access: 2017-06-16 19:10:34.914968689 -0600
Modify: 2017-06-16 18:30:31.135767008 -0600
Change: 2017-06-16 18:30:31.135767008 -0600
Birth: -

Using the -R would also ensure that directories in the /home/user were properly adjusted. For example the .ssh directory has a context of unconfined_u:object_r:ssh_home_t:s0.

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.