linux - 为什么 rwxrwxrwx 文件不允许 chmod 777?

标签 linux permissions file-permissions chmod

我有一个具有 777 访问权限的文件夹,foo 用户属于 pi 组,但我无法更改 foobar 的权限。解释是什么?

$ sudo usermod -a -G pi foo
$ sudo -u foo touch foobar
$ ls -al
total 0
drwxrwxrwx 2 pi pi 0 Feb 27 19:26 .
drwxrwxrwx 6 pi pi 0 Feb 26 15:20 ..
-rwxrwxrwx 1 pi pi 0 Feb 27 19:26 foobar
$ sudo -u foo chmod 777 foobar
chmod: changing permissions of ‘foobar’: Operation not permitted

值得一提的是,坐骑是:

//192.168.1.42/test /media/test/ cifs username=pi,password=p,uid=pi,gid=pi,x-systemd.automount 0 0

编辑

codeforester提醒我 foobarpi 所有,因此 foo 无法更改其权限。所以问题更多的是X-Y problem其中:

我使用通用 pi 用户和组安装了 /media/test/。守护程序用户(例如 foobar)将需要访问 rw 中的此共享文件夹,并且他们应该能够更改权限。我该怎么做?

最佳答案

我认为最简单的解决方案是将 foo 和 bar 添加到 pi 用户组

usermod -G pi foo

关于linux - 为什么 rwxrwxrwx 文件不允许 chmod 777?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42494222/

相关文章:

c - 读取文件并通过管道将其发送到父进程的程序

android - 扩展日历 View - 内容提供商权限被拒绝需要签名

linux - 如果导入“C”,则无法交叉编译

PostgreSQL:不允许角色登录

node.js - 应该怎么做才能在不使用 sudo 的情况下加入项目的两个模块?

linux - 如何将文件权限授予组中的特定用户?

ios - XlsxReaderWriter 创建只读 .xlsx 文件?

linux - 为什么 Apache 不允许从 index.html 中访问 Web 根目录之外的文件?

linux - 无法让我的程序运行 - %GC 计算器

c - 如果我们将两个具有不同数据类型的同名变量链接起来怎么办?