【问题标题】:Unknown file permissions for executable bit - Linux可执行位的未知文件权限 - Linux
【发布时间】:2013-07-14 23:46:01
【问题描述】:

我在Linux下写了一个小文件打开和关闭程序,请在下面找到:

#include <stdio.h>  
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

int main()
{

int fd;

fd = open("/home/jeshwanth/junk/text",O_WRONLY | O_CREAT);

if ( fd == -1)
    printf("Error in opening \n");

close(fd);
return 0;
 }

程序执行后,我发现可执行位显示一些未知权限-rwsrwSr-T。谁能给我解释一下?
提前致谢

【问题讨论】:

    标签: linux file-io file-permissions


    【解决方案1】:

    他们有什么不为人知的?来自ls 手册页:

    The next three fields are three characters each: owner permissions, group
    permissions, and other permissions.  Each field has three character positions:
    
         1.   If r, the file is readable; if -, it is not readable.
    
         2.   If w, the file is writable; if -, it is not writable.
    
         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.)
    
                These next two apply only to the third character in the last
                group (other permissions).
    
                      T     The sticky bit is set (mode 1000), but not execute
                            or search permission.  (See chmod(1) or
                            sticky(8).)
    
                      t     The sticky bit is set (mode 1000), and is search-
                            able or executable.  (See chmod(1) or sticky(8).)
    

    【讨论】:

      猜你喜欢
      • 2013-09-09
      • 2011-12-27
      • 1970-01-01
      • 2017-01-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-12-30
      • 2020-10-12
      相关资源
      最近更新 更多