change location of $HOME/.Xauthority
The location of the X cookie file can be configured with the XAUTHORITY
environment variable. The default is ~/.Xauthority
.
Of course, the location that you pass to applications has to match the location where the cookie is stored. SLiM doesn't offer a way to add the cookie to a different file: it has ~/.Xauthority
hard-coded. If you want to use a different file, patch SLiM or use a display manager that happens to have this configuration option. For example, Gdm stores X cookies under /var/run/gdm
.
I think you can make .Xauthority
a symbolic link, if you don't want the modifiable file to be in your home directory.
Making your home directory immutable is an exercise in futility. You're likely to encounter many other similar issues. The standard place for configuration files and state files is your home directory — that's where dot files get their name, because they start with a .
so that ls
won't list them by default.
Related videos on Youtube
Spudster
Updated on September 18, 2022Comments
-
Spudster almost 2 years
I am making A http://mybb.com plugin, everything is going great so far except for one issue. I am trying to add the functionality on who can view the announcement (yes it's an announcement plugin).
How can I add it in the code if I add if($user_is_admin==true) die;
All that will do is kill the whole software instead of the plugin itself.
-
Admin over 9 yearsHave you looked into exporting a modified
XAUTHORITY
environment variable before the X session is started? it's probably simpler and more maintainable than rolling a custom version of your display manager. -
Admin over 9 years@steeldriver - but how can I export
XAUTHORITY
variable for a user BEFORE the user can log in ? -
Admin over 9 yearsAFAIK it doesn't need to be done before the user logs in, just before the user's X session is started - I don't know the startup sequence for SLiM, but perhaps it's possible via an ~/.xinitrc file?
-
Admin over 9 yearsCould you explain why in the world you would want to set $HOME to immutable? There are many, many files that are automatically created there (I have 109 dotfiles in my
~/
for example). Not all programs use the~/.config
directory and you will face all sorts of issues. This is really not a very good idea. -
Admin over 9 years@terdon - I don't know why you have 109 dotfiles in your home. I have only 6:
.Xauthority .bashrc .gitconfig .netrc .profile .xscreensaver
, plus dot-directories such as.config
. The reason why i want home immutable is, I dont want applications to create files in my home, either by mistake or intent. Also, I want to prevent mistakes by myself. It is easy to mistype and accidentally copy files to $HOME (it happened to me withscp
several times alredy), and thereby overwrite existing files. -
Admin over 9 yearsI have os many because I have many more programs installed presumably. For example
.xscreensaver
,.viminfo
,.emacs
,.zshrc
,.kshrc
. As I said, there are many programs that place their config files in~/
and not in~/.config
. I strongly suggest you don't try to make~/
immutable. It is the default location for all sorts of files. You will have the same problem as you have with.Xauthority
if you try to install another shell or any of hundreds of other programs. -
Admin over 9 yearsI don't need to install any more programs. I already have all I need. Even if I needed, I just need to allow the program once to create its directory, and then I can change back to immutable. I think, if you have hundreds of dotfiles in your home, you have pretty much lost control over your home. You don't know which programs are writing there and you probably would not notice when a suspicions file appears.
-
Admin over 9 years@terdon I agree that making $HOME immutable is a little drastic, but on the other hand I applaud Martin's effort to try and remove the clutter. There is
~/.config
,~/.cache
and~/.local/{bin,share,include,lib}
for all the needed purposes. Applications don't just put their config into root like/myawesomeapp.conf
, so why do that for user-specific configuration?
-
-
Tam Borine over 9 yearsI don't see it as futile at all. When I use different login manager (
wdm
) immutable home works great (.Xauthority
will be created in/tmp
, if home is not writable). I am surprised thatgdm
stores it in/var/run/gdm
. The file is being created with the user privileges, not root. How can user write to/var/run/gdm
? -
Tam Borine over 9 yearsalso, don't forget that once an application has created a dotfile, you can change home to immutable. The application should not need to create more files, and can modify the existing file. You only need to make home mutable once, when new application needs to create a file for the first time. The benefit of immutable home is, it protects me from accidentally overwriting files in my home. As a side note: I consider it a very bad idea to store important configuration files in home directly, It reminds me of the bad practice of Windows, where config files and user data are mixed together.
-
anthony over 5 yearsMartin Vegter.... It is a little more than that... .Xauthority needs to be writable true, BUT it also needs to create lock files like .Xauthority-c at least temporarily.