直接使用sudo chmod命令无法实现,提示没有权限,在root用户执行同样无法实现
26条回答 默认 最新
阿里嘎多学长 2024-10-01 23:04关注获得0.30元问题酬金 AIGC生成:
银河麒麟linux系统如何修改/etc/hosts权限为777
问题描述:在银河麒麟linux系统中,使用sudo chmod命令无法将/etc/hosts文件的权限修改为777,提示没有权限,甚至在root用户下也无法实现。
解决方案:在银河麒麟linux系统中,/etc/hosts文件的权限是受限的,可以使用以下命令来修改权限:
sudo setfacl -m u:root:rwx /etc/hosts sudo setfacl -m u:root:rwx /etc/hosts这两个命令将/etc/hosts文件的权限设置为root用户可以读写执行。
如果你想将权限设置为777,可以使用以下命令:
sudo setfacl -m u:root:rwx,g:root:rwx,o:root:rwx /etc/hosts这将设置/etc/hosts文件的权限为root用户可以读写执行,group用户可以读写执行,其他用户可以读写执行。
注意:在使用setfacl命令时,需要使用sudo权限,以确保命令可以生效。
解决 无用评论 打赏 举报