[Nix-dev] /etc/skel, useradd - resolve symlinks before copying?

Marc Weber marco-oweber at gmx.de
Sat Feb 12 12:54:41 CET 2011


Background:

Whenever you (or nixos) runs useradd -m .. everything in /etc/skel is
copied into the new users home directory.

This is usually used to setup initial .bashrc files etc.

Now NixOS is based on symlinks. Thus /etc/skel/.bashrc -> /nix/store/...

Thus ~/.bashrc -> /nix/store/...

So the user can't edit the file which is bad.

So does it make sense to patch either useradd or the /etc generating
script to not use symlinks so that ~/.bahsrc is a copy of /nix/store/...  ?

useradd code of shadow contains the function copy_tree so I think its
trivial to patch.

There is one reason to keep symlinks: Whenever /etc/skel updates the
contents of the files will update as well. However in the case of shell
initialization files you can put in a "source /etc/.." line to achieve
the same result - and users can use their editors and edit those files.

How do you think about it?

Marc Weber



More information about the nix-dev mailing list