小编Mar*_*k C的帖子

如何正确设置 sudo/visudo 的编辑器?

我正在使用 Ubuntu 10.04 Server 并尝试设置 sudoers 以尊重用户的 EDITOR 选择(在限制范围内)

在我的 sudoers 中,我有:

Defaults        editor=/usr/bin/nano:/usr/bin/vim
Defaults        env_reset
Run Code Online (Sandbox Code Playgroud)

在用户 .bashrc 中:

export EDITOR=/usr/bin/vim
Run Code Online (Sandbox Code Playgroud)

$EDITOR 设置:

$ echo $EDITOR
/usr/bin/vim
Run Code Online (Sandbox Code Playgroud)

根据man sudoers这应该足以将 $EDITOR 设置为 vim:

editor  A colon (':') separated list of editors allowed to be used with visudo.
        visudo will choose the editor that matches the user's EDITOR environment
        variable if possible, or the first editor in the list that exists and is
        executable. The default is the path to …
Run Code Online (Sandbox Code Playgroud)

linux sudo ubuntu sudoers ubuntu-10.04

19
推荐指数
3
解决办法
9792
查看次数

标签 统计

linux ×1

sudo ×1

sudoers ×1

ubuntu ×1

ubuntu-10.04 ×1