错误:在保存时,vim 打印“/etc/paths”时出现错误 E212:

huangapple go评论52阅读模式
英文:

bug: vim when save print "/etc/paths" E212:

问题

在终端打开 "vim" 编辑器后,尝试保存路径环境时,当输入 ":qw" 时会出现错误:

保存时,vim 打印出 "/etc/paths" 错误:E212。

英文:

after open "vim" editor by termnial try to save the path enviroment
when write ":qw" it's print error:

vim when save print "/etc/paths" E212

答案1

得分: 1

您的系统默认安装了一些可执行文件,它们位于一些标准目录中。

当在shell中执行程序,比如 $ vim,shell会尝试在这些目录中找到一个名为 vim 的可执行文件,然后尝试执行它找到的第一个可执行文件(如果有的话)。

这些标准目录列在 /etc/paths 文件中,它们都是由 root 拥有的,因为允许任何权限较低的进程删除、添加或更改其中的内容可能会产生非常糟糕的后果。

/etc/paths 文件也由 root 拥有,因为篡改该文件可能会导致非常糟糕的后果,从使默认程序不可访问到用恶意程序覆盖它们。

因此,绝对不建议更改该文件的权限。

如果您真的想要向该文件添加一个目录,那么唯一合适的方法是以 "root" 用户身份执行,可以使用 $ man sudo(建议阅读):

$ sudo -e /etc/paths
英文:

Your system comes with a number of executables by default, placed in a number of standard directories.

When a program is executed in a shell, say $ vim, the shell tries to find a vim executable in those directories and then tries to execute the first one it found, if any.

Those standard directories, listed in /etc/paths, are all owned by root because allowing any less privileged process to remove or add or change anything there could have very bad consequences.

/etc/paths is also owned by root because messing with that file could also have very bad consequences, from making default programs inaccessible to overriding them with malevolent ones.

It is thus not a good idea at all to change the file's permissions.

If you really want to, say, add a directory to that file, then the only appropriate method is to do it "as root", with $ man sudo (recommended reading):

$ sudo -e /etc/paths

答案2

得分: -2

## 错误

"/etc/paths" E212: 无法打开文件进行写入 按ENTER或输入命令以继续


## 问题:
没有编辑权限

## 终端写入:

sudo chmod -R 777 /etc/paths


## 在Mac上编辑文件权限
1- 通过Finder查找文件 >> 转到 >> 输入“/etc/paths/“

2- 然后右键单击文件 >> 文件信息 >> 权限 >> 单击添加(+)图标

3- 选择您的帐户并授予读写访问权限
英文:

error

 "/etc/paths" E212: Can't open file for writing Press ENTER or type command to continue

problem:

Not have permission to edit

termninal write:

sudo chmod  -R 777 /etc/paths

On Mac Edit File Permission

1- Search for file by finder >> go >> type “/etc/paths/“

2- Then right click on file >> file info >> permission >> click icon add (+)

3- select your account and give access read and write

huangapple
  • 本文由 发表于 2023年3月7日 18:40:08
  • 转载请务必保留本文链接:https://go.coder-hub.com/75660907.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定