Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

up vote 5 down vote accepted

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.
share|improve this answer
    
Thanks for your valuable info.. –  user72789 Jul 28 at 13:58

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.