$ ls -laF drwx------ 2 testuser testuser 4096 1月 19 11:34 ./ drwxr-xr-x 11 root root 4096 1月 19 11:34 ../ -rw-r--r-- 1 testuser testuser 24 1月 19 11:34 .bash_logout -rw-r--r-- 1 testuser testuser 176 1月 19 11:34 .bash_profile -rw-r--r-- 1 testuser testuser 124 1月 19 11:34 .bashrc
- 通常のファイル d ディレクトリ l シンボリックリンク
ビット位置 | 内容 |
---|---|
11 | set-user-id |
10 | set-group-id |
9 | sticky |
8 | 所有者 読み出し権限 |
7 | 所有者 書き込み権限 |
6 | 所有者 実行権限 |
5 | 所有グループ 読み出し権限 |
4 | 所有グループ 書き込み権限 |
3 | 所有グループ 実行権限 |
2 | その他ユーザ 読み出し権限 |
1 | その他ユーザ 書き込み権限 |
0 | その他ユーザ 実行権限 |
$ ls -laF /usr/bin/passwd -rwsr-xr-x 1 root root 22984 /usr/bin/passwd*
# mkdir group_off rootでディレクトリを作成 # mkdir group_on # chmod g+s group_on group_onディレクトリのset-group-idをONにする # chmod o+w group_off group_on その他ユーザの書き込み権限を設定 # ls -l drwxr-xrwx 2 root root 4096 1月 19 12:00 group_off drwxr-srwx 2 root root 4096 1月 19 12:00 group_on 所有グループの実行権限が s 表示となる # su testuser testuserでファイルを作成 $ touch group_off/fileA $ touch group_on/fileB $ ls -l group* group_off: -rw-rw-r-- 1 testuser testuser 0 1月 19 12:05 fileA 所有グループ=作成者のグループ group_on: -rw-rw-r-- 1 testuser root 0 1月 19 12:05 fileB 所有グループ=ディレクトリの所有グループ
# mkdir sticky_off rootでディレクトリを作成 # mkdir sticky_on # chmod o+t sticky_on # chmod o+w sticky_off sticky_on その他ユーザの書き込み権限を設定 # ls -l drwxr-xrwx 2 root root 4096 1月 19 12:28 sticky_off drwxr-xrwt 2 root root 4096 1月 19 12:28 sticky_on その他ユーザの実行権限が t 表示となる # touch sticky_off/fileA # touch sticky_on/fileB # ls -l sticky* sticky_off: -rw-r--r-- 1 root root 0 1月 19 12:28 fileA sticky_on: -rw-r--r-- 1 root root 0 1月 19 12:28 fileB # su testuser $ rm -f sticky_off/fileA ディレクトリ書き込み権限あり=root所有のファイルを削除できる $ rm -f sticky_on/fileB rm: cannot remove `sticky_on/fileB': 許可されていない操作です stucky=ONなので、root所有のファイルを削除できないTweet