各ユーザーのホームディレクトリにあるデフォルトファイル

各ユーザーのホームディレクトリにあるデフォルトファイル

Ubuntu Server 14.04を使用しています。ユーザーアカウントが作成されるたびに、デフォルトで各ユーザーのホームディレクトリにいくつかのファイルとフォルダを追加したいと思います。

ベストアンサー1

ディレクトリに追加するファイルを追加できます/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.

おすすめ記事