我有一个具有 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提醒我 foobar
归 pi
所有,因此 foo
无法更改其权限。所以问题更多的是X-Y problem其中:
我使用通用 pi
用户和组安装了 /media/test/
。守护程序用户(例如 foo
和 bar
)将需要访问 rw
中的此共享文件夹,并且他们应该能够更改权限。我该怎么做?
最佳答案
我认为最简单的解决方案是将 foo 和 bar 添加到 pi 用户组
usermod -G pi foo
关于linux - 为什么 rwxrwxrwx 文件不允许 chmod 777?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42494222/