[root@study tmp]#
chmod 6755 test; ls
-
l test
<==
加入具有
SUID/SGID
-
rw
s
r
-
s
r
-
x 1 root root 0 Jun 16 02:53 test
[root@study tmp]#
chmod 1755 test; ls
-
l test
<==
加入
SBIT
的功能!
-
rwxr
-
xr
-
t
1 root root 0 Jun 16 02:53 test
[root@study tmp]#
chmod 7666 test; ls
-
l test
<==
具有空的
SUID/SGID
-
rw
S
rw
S
rw
T
1 root root 0 Jun 16 02:53 test
最后一个例子就要特别小心啦!怎么会出现大写的
S
T
呢?不都是小写的吗?
因为
s
t
是取代
x
这个权限的,但是你有没有发现阿,我们是下达
7666
喔!也就是说,
user, group
以及
others
都没有
x
这个可执行的标志
(
因为
666
)
,所以,这个
S, T
代表的就是『空的』啦
!怎
么说?
SUID
是表示『该文件在执行的时候,具有文件拥有者的权限』,但是文件
拥有者都无法执
行了,哪里来的权限给其他人使用?当然就是空的啦!
^_^
而除了数字法之外,妳也可以透过符号法来处理喔!其中
SUID
u+s
,而
SGID
g+s
SBIT
则是
o+t
啰!来看看如下的范例:
#
限成
-
rws
--
x
--
x
的模
[root@study tmp]#
chmod u=rwxs,go=x test; ls
-
l test
-
rw
s
--
x
--
x 1 root root 0 Jun 16 02:53 test
#
承上,加上
SGID
SBIT
在上述的
文件
限中!
[root@study tmp]#
chmod g+s,o+t test; ls
-
l test
-
rws
--
s
--
t 1 root root 0 Jun 16 02:53 test
6.4.4
观察文件类型:
file
如果你想要知道某个文件的基本数据,例如是属于
ASCII
或者是
data
文件,或者是
binary
其中有没有使用到动态函式库
(share library)
等等的信息,就可以利用
file
这个指令来检阅喔!举例
来说:
[root@study ~]#
file ~/.bashrc
/root/.bashrc: ASCII text
<==
ASCII
文本
啊!
[root@study ~]#
file /usr/bin/passwd
/usr/bin/passwd: setuid ELF
64
-
bit LSB shared object, x86
-
64, version 1 (SYSV), dynamically
linked (uses shared libs), for GNU/Linux 2.6.32,
BuildID[sha1]=0xbf35571e607e317bf107b9bcf65199988d0ed5ab, stripped
#
行文件的
据可就多的不得了!包括
这个
文件
suid
限、兼容于
Intel x86
-
64
的硬件平台
#
使用的是
Linux
核心
2.6.32
动态
函式
库链
½等等。
[root@study ~]#
file /var/lib/mlocate/mlocate.db
/var/lib/mlocate/mlocate.db: data
<==
data
文件