View previous topic :: View next topic |
Author |
Message |
abduct Apprentice
Joined: 19 Mar 2015 Posts: 215
|
Posted: Tue Aug 14, 2018 1:05 am Post subject: Difference between the two xorg auth files |
|
|
So what exactly is the difference between .Xauthority and .serverauth?
I've seen remarks online that .serverauth is not needed and patching startx to write the serverauth to Xauthority files cleans up your home directory.
The reason I am asking is that I wrote a acpi script to lock my session with xautolock, but in order for it to function I had to export my DISPLAY and XAUTHORITY.
Code: | #!/bin/sh
set -e
xpid="$(pgrep -n X)"
xuser="myuser"
display="$(egrep -aoz ':[0-9](.[0-9])?' /proc/$xpid/cmdline)"
export XAUTHORITY="/home/$xuser/.Xauthority"
export DISPLAY="$display"
su - "$xuser" -c "/usr/bin/xautolock -locknow"
sleep 5
/usr/sbin/s2ram
|
Although somehow my .Xauthority file went stale and my script ceased to function. This non functioning script kept non functioning over many reboots and Xorg restarts telling me that for what ever reason the .Xauthority file was not being updated. This was puzzling for a while, but after deleting the .Xauthority and .serverauth files and restarting Xorg my script started functioning again.
So what is exactly the point between the two files, and does patching startx to use the same file harm anything else? Does anything actually depend on .serverauth?
Here is a link to a discussion about it: https://unix.stackexchange.com/questions/199160/what-are-serverauth-files-in-my-home-directory
Edit:: Actually after the first reboot after fixing my .Xauthority file it went stale again and my script is unable to use/find a running xautolock process:
Code: | ./suspend-to-ram.sh: line 6: warning: command substitution: ignored null byte in input
Could not locate a running xautolock.
|
So what on earth are the .Xauthority and .serverauth files for? Is it safe to patch startx to use a single file (.Xauthority)? This must of been a change in xorg recently as probably within the last 6 months it has been working fine. |
|
Back to top |
|
|
josephg l33t
Joined: 10 Jan 2016 Posts: 783 Location: usually offline
|
Posted: Tue Aug 14, 2018 12:14 pm Post subject: |
|
|
I don't know how you start X. I startx, and have not needed to worry about .Xauthority or .serverauth.???? files yet. Those files are automatically created by /usr/bin/startx. Though I remember clearing out several stale ~/.serverauth.???? files, when X crashed for various reasons in the past.
Code: | $ man xauth
...
$HOME/.Xauthority default authority file if XAUTHORITY isn't defined. |
You could define XAUTHORITY to be something else than default. I think there are bugs with Xsecurity, which might affect you if you are in a really secure environment. _________________ "Growth for the sake of growth is the ideology of the cancer cell." Edward Abbey |
|
Back to top |
|
|
abduct Apprentice
Joined: 19 Mar 2015 Posts: 215
|
Posted: Tue Aug 14, 2018 11:43 pm Post subject: |
|
|
I just run startx after logging in as my user. No different that anyone else using startx.
For some reason my .Xauthority file goes stale or something after a reboot because unless i delete it and relaunch xorg via startx, my script in the first post fails to work. Many months back it would work across reboots and even resumes from disk. |
|
Back to top |
|
|
|