/etc/apt/sources.list" E212:无法打开文件进行写入 [英] /etc/apt/sources.list" E212: Can't open file for writing

查看:566
本文介绍了/etc/apt/sources.list" E212:无法打开文件进行写入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用vi编辑器来编辑sources.list,但是在保存文件时出现以下错误:

I am trying to edit sources.list using vi editor but getting the following error while saving the file:

/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的意思.

Vim has a builtin help system. I just quoted what it says to :h E212.

您可能想以超级用户的身份将文件编辑为sudo vim FILE.或者,如果您不想离开现有的vim会话(现在拥有适当的sudo权限),则可以发出:

You might want to edit the file as a superuser as sudo vim FILE. Or if you don't want to leave your existing vim session (and now have proper sudo rights), you can issue:

:w !sudo tee % > /dev/null

将保存文件.

HTH

这篇关于/etc/apt/sources.list" E212:无法打开文件进行写入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆