long ls 输出中大写 S 的含义

long ls 输出中大写 S 的含义

这么长的清单意味着什么?

$> ls -l developer.haml

-rw-rwSr-- 1 人阿帕奇......

我知道通常的列表意味着什么,并且我知道读“r”、写“w”和可执行“x”意味着什么。但“S”是什么?

答案1

从我的man 1 ls

每个字段具有三个字符位置:

...

  3.   The first of the following that applies:

       S     If in the owner permissions, the file is not exe-
             cutable and set-user-ID mode is set.  If in the
             group permissions, the file is not executable and
             set-group-ID mode is set.

       s     If in the owner permissions, the file is exe-
             cutable and set-user-ID mode is set.  If in the
             group permissions, the file is executable and set-
             group-ID mode is set.

       x     The file is executable or the directory is search-
             able.

       -     The file is neither readable, writable, exe-
             cutable, nor set-user-ID nor set-group-ID mode,
             nor sticky.  (See below.)

基本上,

S == setuid/setgid && not executable
s == setuid/setgid && executable
x == not setuid/setgid && executable
- == not setuid/setgid && not executable

答案2

S表示setuid 位已启用,而s表示setuid 位和可执行位均已启用。

相关内容