Is there any possibility to use a placeholder in the config files located in /etc/skel that is replaced by the username later?
e.g. I place ":USER:" in one config file and create a new user with the username "test". Then ":USER:" should be replaced by "test".
Thanks for your replies.
Ubuntu uses
adduser
from Debian, and that program just does a straight up file copy from/etc/skel
, so you're out of luck there. However, it does support hook scripts (look inadduser
(8) foradduser.local
), and you could write a little hook script that did ased -i
over some or all of the files in the newly-created home directory to do your text substitution magic.You can make use of environment variables directly within your shell init scripts. For initialization files interpreted/used by other tools, refer to their methods.
... would add the user's home directory to their path (you might want to do some sanity checks such as that the directory exists first).
See "Shell Variables" within the
bash(1)
manpage for a list of variables defined/used by bash.It would help if you'd clarify specifically what you're trying to do, and why.
I got some useraccount crash thing here, so I'm posting from a new registered account here. Sorry for that.
I Did the following: https://serverfault.com/a/407613/128083
Made it "community wiki" so everyone can add his or her idea how to do it better.