ユーザをuseraddで追加するときに -mオプションを付けると、ユーザ追加と同時に、ホームディレクトリが自動的に生成されます。
生成されたホームディレクトリを見ると、特に何もしていないのに .bashrcや .profileなどが置かれています。これらのファイルはどこから来たのでしょう?
# useradd testuser -m # cd /home/testuser/ # ls -la total 12 drwxr-xr-x 2 testuser testuser 128 Oct 11 16:50 . drwxr-xr-x 8 root root 184 Oct 11 16:50 .. -rw-r--r-- 1 testuser testuser 220 Dec 12 2006 .bash_logout -rw-r--r-- 1 testuser testuser 3515 Nov 13 2014 .bashrc -rw-r--r-- 1 testuser testuser 675 May 13 2008 .profile
答えだけ言ってしまうと、Debianの場合 /etc/skelというディレクトリが、ホームディレクトリのひな型となります。
# ls -la /etc/skel total 21 drwxr-xr-x 2 root root 128 May 1 05:06 . drwxr-xr-x 173 root root 9128 Oct 11 16:50 .. -rw-r--r-- 1 root root 220 Dec 12 2006 .bash_logout -rw-r--r-- 1 root root 3515 Nov 13 2014 .bashrc -rw-r--r-- 1 root root 675 May 13 2008 .profile
Debian以外のディストリビューションでも、ひな型となるディレクトリがあるはずなので、探してみると面白いかもしれません。
< | 2015 | > | ||||
<< | < | 10 | > | >> | ||
日 | 月 | 火 | 水 | 木 | 金 | 土 |
- | - | - | - | 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
合計:
本日:
管理者: Katsuhiro Suzuki(katsuhiro( a t )katsuster.net)
This is Simple Diary 1.0
Copyright(C) Katsuhiro Suzuki 2006-2023.
Powered by PHP 8.2.18.
using GD 2.3.3(png support.)