Linux 周不工作

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14966140/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-06 19:04:20  来源:igfitidea点击:

Chown not working

linuxubuntupermissionschown

提问by Corbz

On Ubuntu 12.04, the chown command doesn't seem to be working like it should

在 Ubuntu 12.04 上,chown 命令似乎无法正常工作

root@server:/var/www/folder/# ls -al

root@server:/var/www/folder/# ls -al

Running this puts out

运行这个会退出

drwxr-xr-x 11 776 sftponly 4096 Feb 17 14:08 Other_Folder

drwxr-xr-x 11 776 sftponly 4096 2 月 17 日 14:08 Other_Folder

I need write permissions for the group, so I run:

我需要组的写权限,所以我运行:

chown -R 776 ./Other_Folder

chown -R 776 ./Other_Folder

Then when I run ls -al again, the output is still

然后当我再次运行 ls -al 时,输出仍然是

drwxr-xr-x 11 776 sftponly 4096 Feb 17 14:08 Other_Folder

drwxr-xr-x 11 776 sftponly 4096 2 月 17 日 14:08 Other_Folder

回答by Nicholas Pickering

chownis used to change ownership of the file, not change permissions.

chown用于更改文件的所有权,而不是更改权限。

ls -alis not showing you who owns the file, just its permissions.

ls -al没有显示谁拥有该文件,只显示其权限。

If root owns those files, you'll need to chownthem properly, before you can change their permissions:

如果 root 拥有这些文件,您需要chown正确使用它们,然后才能更改它们的权限:

chown -R yourname:yourname folderName

Then as the owner you can change their permissions:

然后作为所有者,您可以更改他们的权限:

chmod -R 776 folderName

Edit:I double checked the syntax and it seems to be right, you'll likely need to use sudo to use them.

编辑:我仔细检查了语法,它似乎是正确的,您可能需要使用 sudo 来使用它们。