Linux “sudoedit”和“sudovim”之间有什么区别?
Linux “sudoedit”和“sudovim”之间有什么区别?,linux,vim,sudo,Linux,Vim,Sudo,sudovim/etc/services和sudoedit/etc/services之间有什么区别?我试图在linux中编辑/etc/services文件sudoedit允许编辑,但sudo vim不允许编辑。sudoedit使用-e选项指定sudo。从手册页: -e The -e (edit) option indicates that, instead of running a command, the user wishes to edit o
sudovim/etc/services
和sudoedit/etc/services
之间有什么区别?我试图在linux中编辑/etc/services
文件sudoedit
允许编辑,但sudo vim
不允许编辑。sudoedit
使用-e
选项指定sudo
。从手册页:
-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.
因此,它允许系统管理员仅允许sudo权限编辑某些文件,而不允许特定命令或所有文件。它允许管理员控制用户(或用户组)可以使用提升的权限编辑哪些文件
此外,用户仍然可以使用他/她的首选编辑器,而不是管理员指定的编辑器。它还以用户自身的身份运行此编辑器,这意味着用户在
.vimrc
中指定的任何选项或命令(例如)都将适用。sudo vim/etc/services
告诉shell以超级用户权限使用vim editor编辑给定的文件
然而,
sudoedit/etc/services
告诉shell使用编辑器环境变量中存储的任何编辑器来使用超级用户权限编辑文件 我想你会在超级用户上得到更多关于这类问题的帮助。sudoedit
允许你作为另一个用户sudo
。这很好地回答了这个问题。总之,sudoedit
为您正在编辑的文件创建一个由普通用户(而不是根用户)拥有的临时副本,并在退出编辑器时保存原始文件。因为,当您编辑临时副本时,编辑器作为普通用户运行,.vimrc
被正常加载,您可以保持语法突出显示和其他vim插件(如果您使用sudo vim
),则不应如此)。Ya。。这也是正确的。。我通过设置编辑器
变量进行了检查。将EDITOR
变量设置为vim
后,我可以看到文件在vim
中打开,否则在vi
中打开。