【问题标题】:Linux folder move accessLinux文件夹移动访问
【发布时间】:2015-12-16 02:58:32
【问题描述】:

Linux 文件系统是否能够允许或拒绝移动文件夹的权利?据我所知,Active Directory 没有。我很好奇,3 种不同的措辞没有产生任何结果。

【问题讨论】:

    标签: linux filesystems elevated-privileges


    【解决方案1】:

    是的。如果您有一个文件夹 foo/bar/,您可以将文件夹 foo 设为只读,这将阻止人们移动 bar

    $ chmod a-w foo
    $ mv foo/bar ack
    mv: cannot move ‘foo/bar’ to ‘ack’: Permission denied
    

    不能移动bar,但他们仍然可以改变里面的东西:

    $ echo hello > foo/bar/hello.txt
    $ rm foo/bar/hello.txt
    

    【讨论】:

      【解决方案2】:

      在 linux 中,您可以使用 chattr 使文件或文件夹不可变,如下所示:

      chattr +i file
      

      这样,即使是超级用户也不能移动、修改或删除文件。

      要恢复它,您可以使用:

      chattr -i file
      

      这适用于 ext 文件系统

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-12-18
        • 1970-01-01
        • 2011-08-25
        • 1970-01-01
        • 2016-10-19
        • 2015-07-30
        相关资源
        最近更新 更多