English 中文(简体)
不得继承许可的符号链接
原标题:Symbolic link not inheriting permissions
  • 时间:2011-09-20 15:34:46
  •  标签:
  • shell
  • ln

例如,我有770份许可。 当我做时:

ln -s foo.sh bar.sh

联系酒吧有2777份许可。 为什么如此? 我认为,他们打算继承吗?

最佳回答

关于象征性联系的许可基本上不重要。 他们通常为777人,经修补。

rel=“noreferer”>symlink( 说:

The values of the file mode bits for the created symbolic link are unspecified. All interfaces specified by POSIX.1-2008 shall behave as if the contents of symbolic links can always be read, except that the value of the file mode bits returned in the st_mode field of the stat structure is unspecified.

POSIX提供lchown(。 系统电话:不提供<><>>条码>lchmod(>/s>功能。

(关于我的MacOS X 10.7.1, umask 022, 新近创建的Symlink以755份许可告终;与Mumask 002一样,许可有效期为775。) 因此,有770 700条许可等许可的链接可能会准确无误;许可环境仍然非实质性,不影响连接线的可用性。


Further investigations about symlinks on RHEL 5 and MacOS X

  1. 关于林丹(RHEL 5, ×86_64;kernel 2.6.18-128.el5),我只看到在 s立时有777次许可:

    $ (ls -l xx.pl; umask 777; ln -s xx.pl pqr; ls -l xx.pl pqr)
    -rw-r--r-- 1 jleffler rd 319 2011-09-05 22:10 xx.pl
    lrwxrwxrwx 1 jleffler rd   5 2011-09-21 10:16 pqr -> xx.pl
    -rw-r--r-- 1 jleffler rd 319 2011-09-05 22:10 xx.pl
    $
    

    我认为,在一个小小小小小小块中,马斯克环境不是永久的。

  2. On MacOS X (10.7.1), I get to see variable permissions on a symlink:

    $ (ls -l xxx.sql; umask 777; ln -s xxx.sql pqr; ls -l xxx.sql pqr)
    -rw-r--r--  1 jleffler  staff  1916 Jun  9 17:15 xxx.sql
    
    ls: pqr: Permission denied
    l---------  1 jleffler  staff     7 Sep 21 10:18 pqr
    -rw-r--r--  1 jleffler  staff  1916 Jun  9 17:15 xxx.sql
    $
    

    Note that this is the same command sequence (give or take the file name) linked to.

  3. On MacOS 页: 1 指挥权可选择<代码>-h,以改变对电离层连接本身的许可:

    -h If the file is a symbolic link, change the mode of the link itself rather than the file that the link points to.

  4. On MacOS X,关于link关问题的许可;除非你读过关于link子的许可(或你重生)。 因此,上文<代码>ls输出的错误。 http://www.ohchr.org。 Ec.

  5. 关于MacOS X,chmod -h 100 pqr(execute)允许我使用链接(cat pqr work),但不能读到链接。 相比之下,<代码>chmod -h 400 pqr 允许我阅读链接并使用链接。 为了完整起见,chmod -h 200 pqr 请允许我利用这一联系,但不要阅读。 我假定,未经正式测试,类似规则适用于群体和其他群体。

  6. On MacOS 因此,在X时,看上或写上短程的许可似乎允许你通常使用,但仅凭执行许可就意味着,即使你能够在链接的另一端查阅档案(或大概是目录)。

Conclusion (subject to modification):

  1. On some versions of Linux, you can only get 777 permission on a symlink.
  2. On MacOS X, you can adjust the permissions on a symlink and these affect who can use the symlink.

The MacOS X behaviour is an extension of the behaviour mandated by POSIX - or deviation from the behaviour mandated by POSIX. It complicates life slightly. It means that you have to ensure that anyone who is supposed to use the link has permission to do so. This is normally trivial (umask 022 means that will be the case).

基础系统呼吁在澳门建立<代码>chown-h 页: 1

问题回答




相关问题
KornShell- Creating a fixed width text file

I need to create a simple fixed width text file in KornShell (ksh). My current attempt using printf to pad the string isn t working out very well. What s the shortest, cleanest way to create a fixed ...

unix find command

how to use the find command to find files/directories which are not matching the pattern. for eg: find <some options > -name "dontfile.txt" should give me output of all the find whose file ...

encoding of file shell script

How can I check the file encoding in a shell script? I need to know if a file is encoded in utf-8 or iso-8859-1. Thanks

Case insensitive comparison of strings in shell script

The == operator is used to compare two strings in shell script. However, I want to compare two strings ignoring case, how can it be done? Is there any standard command for this?

1. 露台式照像

在Windows XP中,没有一时出现指挥时,是否有办法操作一种灰色文字? 我常常需要把“善待”(工作)与“灰色”同起来,即使我的文字没有产出,......

热门标签