Reputation: 903
I was wondering if it was possible to override the SKEL property when adding a user in Linux.
Man page gives me everything to change dynamically any property (SHELL, HOME, ...) but not SKEL.
What I want to do is find a way to assign one profile or another to the users I'm creating.
For instance, I need to create a user with a .profile
in which VAR=value1
, and another user with a .profile
in which VAR=value2
. My idea was to create different SKEL, one for those who need VAR=value1
, another for those needing VAR=value2
, and simply execute adduser ... -D -magic_option /SKEL/for/value1
or adduser ... -D -magic_option /SKEL/for/value2
. But -magic_option
doesn't seem to exist.
Any suggestion?
Upvotes: 1
Views: 726
Reputation: 290025
Of course, just use the -k
option in useradd
:
-k, --skel SKEL_DIR
The skeleton directory, which contains files and directories to be copied in the user's home directory, when the home directory is created by useradd.
This option is only valid if the -m (or --create-home) option is specified.
If this option is not set, the skeleton directory is defined by the SKEL variable in /etc/default/useradd or, by default, /etc/skel.
If possible, the ACLs and extended attributes are copied.
So you can create your /my/skel_for_users
and /my/other_skel_for_users
and use either of them whenever creating one.
Upvotes: 3