主机文件不可编辑,即使是 root 用户

Ale*_*ing 5 file-permissions macos

我正在尝试在 Mac OS X Lion 10.7.4 上编辑我的主机文件。我已经尝试了所有可以使用的终端技巧,但是在尝试修改文件时总是得到“不允许操作”。我试过了:

sudo chmod 777 /etc/hosts
sudo chmod nouchg /etc/hosts
sudo cp ~/hosts /etc/hosts
Run Code Online (Sandbox Code Playgroud)

全部失败并显示“不允许操作”消息。这是输出ls -lO@e /etc/hosts

-rw-r--r--  1 root  wheel  uappnd,nodump,opaque 2073 Sep 22  2010 /etc/hosts
Run Code Online (Sandbox Code Playgroud)

不幸的是,我不知道如何阅读其中的大部分内容。有小费吗?

Kyl*_*nes 4

设置了用户仅附加标志。跑步

sudo chflags nouappnd /etc/hosts

并且您应该能够以超级用户身份编辑和保存文件。