7

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.

0

1 Answer 1

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.
0

Not the answer you're looking for? Browse other questions tagged .