sudo vim /etc/services和sudoedit /etc/services有什么区别?我尝试在linux中编辑/etc/services文件。sudoedit允许编辑,但sudo vim不允许编辑。
发布于 2014-02-28 09:40:30
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中指定的任何选项或命令。
发布于 2014-02-28 09:46:35
sudo vim /etc/services告诉外壳程序以超级用户权限使用vim编辑器来编辑给定的文件。
然而,sudoedit /etc/services告诉shell使用editor环境变量中存储的任何编辑器来使用超级用户权限编辑文件。
https://stackoverflow.com/questions/22084422
复制相似问题