`sudoedit`和`sudo vim`有什么区别?

Nad*_*raj 13 linux vim sudo

sudo vim /etc/services和之间有什么区别sudoedit /etc/services?我试图/etc/services在linux中编辑该文件.sudoedit允许编辑,但sudo vim不允许编辑.

Pur*_*ien 17

sudoeditsudo使用-e选项指定.从手册页:

 -e          The -e (edit) option indicates that, instead of running a command, the
             user wishes to edit one or more files.  In lieu of a command, the string
             "sudoedit" is used when consulting the security policy.  If the user is
             authorized by the policy, the following steps are taken.
Run Code Online (Sandbox Code Playgroud)

因此,它允许系统管理员仅允许sudo权限来编辑某些文件,而不是特定命令或所有文件.它允许管理员控制用户(或用户组)可以使用提升的权限编辑哪些文件.

而且,用户仍然可以使用他/她的首选编辑器,而不是管理员指定的编辑器.它还以用户自身的身份运行此编辑器,这意味着用户在a中指定的任何选项或命令.vimrc都将适用.


小智 7

sudo vim /etc/services 告诉shell使用超级用户权限的vim编辑器来编辑给定的文件.

然而,sudoedit /etc/services告诉shell使用EDITOR环境变量中存储的任何编辑器来使用超级用户权限编辑文件.