Default files in home dir for each user
8,047
You can add the files you want to /etc/skel
directory.
$ sudo touch /etc/skel/test.txt
$ sudo useradd -m test
$ ls /home/test
test.txt
From man 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.
Related videos on Youtube
Author by
user72789
Updated on September 18, 2022Comments
-
user72789 over 1 year
I'm using ubuntu server 14.04. I want to add some files and folders by default in each user's home directory, whenever a user account is created.