HostOnNet Blog

sudo

Looking for Linux Server Admin or WordPress Expert? We can help.

sudo allow normal user to run commands as user root.

By default users in groups “sudo” and “admin” can use sudo on Debian/Ubuntu. On CentOS/RHEL group name is “wheel”.

You can edit sudo permissions for user/group with command

visudo

visudo store files in /etc/sudoers file.

Allow a normal user to run all commands with sudo

USERNAME_HERE ALL=(ALL:ALL) ALL

Replace USERNAME_HERE with actual username of the user you want to give sudo privileges. Another way is to add this user to group sudo, both are same.

Allow a normal user to use sudo with out password prompt

USERNAME_HERE ALL=(ALL:ALL) NOPASSWD: ALL

Allow a normal user to run specific command as user root

To allow user with name “hoston” to use mount command, add following in visudo

hoston ALL=(root) NOPASSWD: /bin/mount

Here NOPASSWD means user will not get any password prompt.

Posted in Linux

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.