Gor*_*don 20 linux security permissions file-permissions ubuntu
我正在运行 Ubuntu 10.04 服务器,并且对用户/组有一些非常反直觉的体验。例如:
sudo touch test_file # create empty file
sudo groupadd test # create 'test' group
sudo chown root:test test_file # change group of file to 'test'
sudo chmod g+rwx test_file # give write permissions to group
sudo usermod -a -G test {my-user} # add my user to 'test' group
touch test_file # touch the file as my current user
Run Code Online (Sandbox Code Playgroud)
最后一行产生权限错误。
我已经确保我的用户是“测试”组的一部分(groups {my-user}
证实了这一点)。test_file 的组也肯定设置为'test',并且设置了组权限。
为什么我的用户不能写入文件测试文件?
Dae*_*yth 30
将用户添加到新组时,不会应用于任何当前正在运行的进程,只会应用于新进程。您需要注销然后重新登录。
注销和重新启动服务器方法对我都不起作用。
然而,这种方法对我有用:(参考这个答案)
chmod g+rwxs <parent folder>
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
18468 次 |
最近记录: |