I need to automatically assign every new user that gets created a certain folder Sales
in their home directory. (e.g. when you add the user tim
, tim
automatically gets a folder named Sales
in his home directory)
How can I do this?
adduserautostarthome-directoryskelusers
I need to automatically assign every new user that gets created a certain folder Sales
in their home directory. (e.g. when you add the user tim
, tim
automatically gets a folder named Sales
in his home directory)
How can I do this?
Best Answer
All new users' home directories are copies of
/etc/skel
when the user gets created through any method that automatically creates a home directory.If you are sure that you need the
Sales
folder on every new user account's home directory, you can just create the folder in/etc/skel
.Make sure the owner and permission of everything you create or modify in there is correct.
Set the permissions you want, they will be copied to the new user's home directory as they are. Usually you take
644
(octal representation) orrw-r--r--
(string representation). You can modify this with one the commands below. Make sure everything is owner-readable and all directories are owner-executable (otherwise the owner can't list or access their content).sudo chmod 644 /etc/skel/FILE_OR_DIRECTORY
to set permissions for a single file or directory using the octal representation.sudo chmod u=rw,g=r,o=r /etc/skel/FILE_OR_DIRECTORY
to set permissions for a single file or directory using a syntax similar to the string representation.sudo chmod -R 644 /etc/skel
to recursively set permissions for all files and directories using the octal representation.sudo chmod -R u=rw,g=r,o=r /etc/skel
to recursively set permissions for all files and directoriesusing a syntax similar to the string representation.The owner should be
root
. You change this recursively on all files and folders in/etc/skel
with the command below: