Allow a normal user to run commands as root in Unix/linux

Sudo command allows users to do tasks on a Linux system as another user.

Sudo is more secure then su command.

Log files : /var/log/secure (Red Hat/Fedora / CentOS Linux)

/var/log/auth.log (Ubuntu / Debian Linux).

So we can get the details using above log files that which user has perform which task or command using sudo or as privilage user.

Below is the general syntax for /etc/sudoers file

Use of Sudo :

2 )Enter this line in open file

3 ) Save the file

4 ) Now user tapas can reboot the server using below command

You can see the information of this user in /var/log/auth.log or /var/log/secure file

Examples :

1) Specify multiple commands for user tapas:

2) Allow user tapas to run /sbin/reboot without any password

3) Allow user tapas to run any command from /usr/bin directory on the localhost:

Share and Enjoy

  • Facebook
  • Twitter
  • Delicious
  • LinkedIn
  • StumbleUpon
  • Add to favorites
  • Email
  • RSS
The following two tabs change content below.

Tapas Mishra

Sr. Engineer (DevOps)
Loves to work on Opensource products. Having experience on Linux environment. Knowledge on Public cloud services like AWS, Rackspace, DigitalOcean, Linode. Please don't hesitate to give a comment on the posts. Your comments are my strength.

3 thoughts on “Allow a normal user to run commands as root in Unix/linux

Leave a Reply