Files
每個使用者的主目錄中的預設文件
我正在使用 ubuntu 伺服器 14.04。每當創建使用者帳戶時,我想預設在每個使用者的主目錄中添加一些文件和文件夾。
您可以將您想要的文件添加到
/etc/skel
目錄中。$ sudo touch /etc/skel/test.txt $ sudo useradd -m test $ ls /home/test test.txt
來自
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.