在终端,我这样做:
sudo vi /etc/profile
Run Code Online (Sandbox Code Playgroud)
但我得到了一个只读版本。作为超级用户,我从来都无法编辑任何东西——这是怎么回事?
小智 9
/etc/profile 是只读的。
你可以让它可写
$ sudo chmod +w /etc/profile
Run Code Online (Sandbox Code Playgroud)
或者更好的是vi,用 覆盖只读文件Esc-wq!
小智 1
运行ls -l后/etc/profile发现连所有者都没有写权限:
$ ls -la /etc/profile
-r--r--r-- 1 root wheel 189 May 4 2009 /etc/profile
Run Code Online (Sandbox Code Playgroud)
您可以让所有者像这样编辑它:
sudo chmod u+w /etc/profile
Run Code Online (Sandbox Code Playgroud)
然后您应该能够将其编辑为root.
| 归档时间: |
|
| 查看次数: |
23201 次 |
| 最近记录: |