Edit Sudoers File – visudo

1) Open the sudoers file safely:
visudo command edits the sudoers file in a safe fashion.
Attention: you can only run visudo as root

This is a vi editor. Here are some basic vi commands:

To enter vi insert mode: i
To enter vi command mode: [esc]
To exit vi and save changes: ZZ or :wq
To exit vi without saving changes: :q!

2) Update the sudoers file
Update the part where you see:
## Allow root to run any commands anywhere
root ALL=(ALL) ALL

Add the desired user name and ALL=(ALL) ALL. For example:
user1 ALL=(ALL) ALL


Didn't find what you were looking for? Try these links:

You can follow any responses to this entry through the RSS 2.0 feed.