/usr/sbin/visudo
This wiki page is about a path or a file in the Linux file system. Be bold and improve it! Describe its purpose and its use, which program created it and uses it, which configuration settings it might be dependent on, and which Linux distributions typically have this file by default while others might not.
If you have any questions about the content on this page, don't hesitate to open a new ticket and we'll do our best to assist you.
http://linux.overshoot.tv/wiki/sudo
$EDITOR
Setting $EDITOR in ~/.bashrc may not work for security reasons (??).
On a gentoo system, sudo
is build with the options: --with-editor=/usr/libexec/editor --with-env-editor
.
Question: don't those two options conflict with each other? Document what /usr/libexec/editor does.
However, you may create an appropriate file within /etc/env.d/ to set $EDITOR, e.g.:
# cat /etc/env.d/88.visudo-editor
EDITOR="/usr/bin/vim"
The update the environment. On a Gentoo system, do:
# env-update
User environment
Quoting man sudo:
-E, --preserve-env
Indicates to the security policy that the user wishes to preserve their existing environment variables.
The security policy may return an error if the user does not have permission to preserve the environment.
Thus having set $EDITOR in the user environment (e.g. in ~/.bashrc
), the following should work:
$ sudo -E visudo