Linux & selinux: xauth timeout in locking authority file .Xauthority SOLVED

Error:

Last login: Tue Jan 20 14:17:19 2015 
/usr/bin/xauth:  timeout in locking authority file /home/jason/.Xauthority

Attempting to manually generate a new .Xauthority file results in the same error:

$ xauth generate :0 .trusted
xauth:  timeout in locking authority file /home/jason/.Xauthority

If the SELinux configuration is set to enforcing then we need to make sure the home directories are set in the correct context:

[root@localhost selinux]# egrep -e '^SELINUX=' /etc/selinux/config
SELINUX=enforcing

Taking a look at the SELinux settings for the home directories (use Z with the ls command):

[root@localhost ~]# ls -aslZ /home/
total 36
drwxr-xr-x. root    root    system_u:object_r:home_root_t:s0 .
drwxr-xr-x. root    root    system_u:object_r:root_t:s0      ..
drwx------. 55 unconfined_u:object_r:home_root_t:s0 jason users   4096 Jan 20 14:22 jason

The context for my home directory (jason) should be unconfined_u:object_r:user_home_dir_t:s0 and not unconfined_u:object_r:home_root_t:s0 as it is a home directory and not part of the root file system per se.

The easiest thing to do is just reset (restore) the context using restorecon as root

[root@localhost ~]# restorecon /home/jason

Verify that the context was changed:

[root@locahost ~]# ls -aslZ /home/
total 36
drwxr-xr-x. root    root    system_u:object_r:home_root_t:s0 .
drwxr-xr-x. root    root    system_u:object_r:root_t:s0      ..
drwx------. jason users   unconfined_u:object_r:user_home_dir_t:s0 jason

Verify fix:
Verify with a new ssh connection (with X11 Forwarding enabled):

Last login: Tue Jan 20 14:19:15 2015 
/usr/bin/xauth:  creating new authority file /home/jason/.Xauthority
$ xeyes

Capture

Share Button