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.
Asked
Active
Viewed 9,164 times
1 Answers
8
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.
cuonglm
- 150,973
- 38
- 327
- 406