文件夹的基数为:777
umask
[root@beryl ~]# cd /tmp
[root@beryl tmp]# mkdir natasha
[root@beryl tmp]# ls -ld natasha/
drwxr-xr-x 2 root root 4096 Apr 15 09:05 natasha/
[root@beryl tmp]# chmod 2755 natasha/
[root@beryl tmp]# ls -ld natasha/
drwxr-sr-x 2 root root 4096 Apr 15 09:05 natasha/
[root@beryl tmp]# chmod 0755 natasha/
[root@beryl tmp]# ls -ld natasha/
drwxr-xr-x 2 root root 4096 Apr 15 09:05 natasha/
[root@beryl tmp]# chmod 4755 natasha/
[root@beryl tmp]# ls -ld natasha/
drwsr-xr-x 2 root root 4096 Apr 15 09:05 natasha/
[root@beryl tmp]# chmod 0755 natasha/
[root@beryl tmp]# chmod 1755 natasha/
[root@beryl tmp]# ls -ld natasha/
drwxr-xr-t 2 root root 4096 Apr 15 09:05 natasha/
[root@beryl tmp]# chmod g-s natasha/
[root@beryl tmp]# ls -ld natasha/
drwxr-xr-x 2 root root 4096 Apr 15 09:05 natasha/
[root@beryl tmp]# chmod 2777 natasha/
[root@beryl tmp]# ls -ld natasha/
drwxrwsrwx 2 root root 4096 Apr 15 09:05 natasha/
[root@beryl tmp]# su - natasah
su: user natasah does not exist
[root@beryl tmp]# su - natasha
su: user natasha does not exist
[root@beryl tmp]# useradd natasha
[root@beryl tmp]# su - natasha
[natasha@beryl ~]$ cd /tmp
[natasha@beryl tmp]$ ls -ld natasha/
drwxrwsrwx 2 root root 4096 Apr 15 09:05 natasha/
[natasha@beryl tmp]$ cd natasha
[natasha@beryl natasha]$ ll
total 0
[natasha@beryl natasha]$ touch file
[natasha@beryl natasha]$ ll
total 0
-rw-rw-r-- 1 natasha root 0 Apr 15 09:42 file
让普通用户可以重启系统:
[natasha@beryl natasha]$ which reboot
/usr/bin/reboot
[natasha@beryl natasha]$ ll /usr/bin/reboot
lrwxrwxrwx 1 root root 13 Apr 12 02:09 /usr/bin/reboot -> consolehelper
[natasha@beryl natasha]$ ll /usr/bin/consolehelper
-rwxr-xr-x 1 root root 5968 Sep 8 2008 /usr/bin/consolehelper
[natasha@beryl natasha]$ su -
Password:
[root@beryl ~]# chmod u+s /usr/bin/consolehelper
[root@beryl ~]# ll /usr/bin/con
conjure conmen consolehelper-gtk
conman consolehelper convert
[root@beryl ~]# ll /usr/bin/consolehelper
-rwsr-xr-x 1 root root 5968 Sep 8 2008 /usr/bin/consolehelper
[root@beryl ~]# su - natasha
[natasha@beryl ~]$ reboot