vi – /etc/apt/sources.list“E212:无法打开文件进行写入

我试图编辑sources.list使用vi编辑器,但保存文件时收到以下错误:

/etc/apt/sources.list" E212: Can't open file for writing
For some reason the file you are writing to cannot be created or overwritten.
The reason could be that you do not have permission to write in the directory
or the file name is not valid.

Vim有一个内置的帮助系统,我只是引用它说:h E212。您可能希望以超级用户(如sudo vim FILE)编辑文件。或者如果您不想离开现有的vim会话(并且知道具有适当的sudo权限),您可以发出:

:w !sudo tee % > /dev/null

其中将保存文件。

HTH

http://stackoverflow.com/questions/8253362/etc-apt-sources-list-e212-cant-open-file-for-writing

本站文章除注明转载外,均为本站原创或编译
转载请明显位置注明出处:vi – /etc/apt/sources.list“E212:无法打开文件进行写入