Using sudo to delegate permissions in Linux | Enable Sysadmin

The /etc/sudoers file should always be modified using the visudo command because this command helps to keep you from causing configuration errors that might make the resultant file unusable (i.e However, if visudo is configured with the --with-env-editor option or the env_editor Default variable is set in sudoers, visudo will use any the editor defines by VISUAL or EDITOR. Note that this can be a security hole since it allows the user to execute any program they wish simply by setting VISUAL or EDITOR. visudo will then only use SUDO_EDITOR, VISUAL or EDITOR if they match a value specified in editor. If the env_reset flag is enabled, the SUDO_EDITOR, VISUAL and/or EDITOR environment variables must be present in the env_keep list for the env_editor flag to function when visudo is invoked via sudo . I need to run something as sudo without a password, so I used visudo and added this to my sudoers file: MYUSERNAME ALL = NOPASSWD: /path/to/my/program Then I tried it out: $ sudo /path/to/my/pro Apr 20, 2020 · Use the visudo command because it is designed to enable any changes as soon as the file is saved and you exit from the editor. It is possible to use editors besides vi in the same way as visudo . Let’s start analyzing this file at the beginning with a couple of types of aliases. Yeah visudo is basically vi with syntax correction embedded AFAIK, so that's its normal state. You can still edit sudoers file with nano or whatever you use. Wish we had a choice in that matter, though syntax correction mechanism for sudoers is probably only implemented for vi. I get 'visudo: /etc/sudoers.tmp unchanged' after I just view w/o making any changes, but I can run visudo both as root and as a user. Last edited by karol (2010-09-06 12:28:53) Offline

Sep 16, 2012

Take Control of your Linux | sudoers file: How to with Type ":x" to save and exit. Can I change the default visudo editor? Yes, changing the default visudo editor is easy. And just because of your dedication, and still reading until here, I'll show you how to set nano or vim to use with visudo command as default editor. Using vim with visudo. export VISUAL=vim; visudo Using nano with visudo

Dec 05, 2018 · The default inactivity timeout is usually 5 minutes before Linux will prompt for your sudo password again. You can extend this timeout by editing the sudoers file. The visudo command opens an editor and points it to the sudoers file (Ubuntu defaults to nano, other systems use Vi) sudo visudo Look for the line Defaults env_reset

Make sudo work harder - IBM Oct 06, 2009