Visudo

use as root command “groups” will tell you which groups you are in

visudo -f /etc/sudoers

Defaults=targetpw
ALL ALL=(ALL) ALL

You have two “modes”

  • Command mode – Press ‘ESC’ to access.

  • Insert mode – Press ‘I’ to access.
    You’re always in one or the other.

  • To move the insertion point around, press ‘ESC’ and use the arrow keys.

  • Once you’re where you want to be, press ‘I’ and start entering text.

  • To delete a character, you need to be in command mode, select the character and press the delete key. (Note: not the Backspace key) You can do this in insert mode, but it does some funky things with the text.

  • To save your changes, in command mode, type :w and press enter.

  • To quit, in command mode, type :q and press enter.

  • To quit without saving any changes, in command mode, type :q! and press enter.

To add your login to the sudo group:

$ su

adduser mbc sudo

FromRedhat

visudo

edit to look like:

Allows people in group wheel to run all commands

%wheel ALL=(ALL) ALL

save and exit

usermod -aG wheel mbc

Now test that it worked:

su USERNAME -

$ groups
mbc wheel

$sudo whoami

after password prompt should return “root”

Share