How To Allow Normal User Run Commands As Root In Linux?

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/allow-normal-user-run-commands-root-linux/
PINTEREST
PINTEREST
INSTAGRAM

We have an application that needs higher privileges than normal user. This application may be run with root user. But we need to run this application with normal user with root privileges.

Sudo

sudo command is used to elevate user privileges. Generally used to run commands as root user. Commands issued with sudo are logged into /var/log/auth.log

Sudoers

Sudoers is sudo configuration file where sudo enabled users are list. Beyond listing users also their permissions are set in this file.

Sudoers file can be access from /etc/sudoers 

Example sudoers file can be found below

Add User To Wheel Group To Enable Admin Access

There are different ways to get root privileges. Most used way is to add user to the wheel group. Whell is a special group where users in this group have root privileges.

LEARN MORE  Python Command Line Arguments

Now user test2 can run higher privilege commands like below

Add User Specifically In The Sudoers File

We can add user test2 to the sudoers file like adding following line.

  • We will add our user with echo to the /etc/sudoers file
  • test2 is the username
  • ALL=(ALL)     ALL line will add all privileges to the test2 user.

 

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/allow-normal-user-run-commands-root-linux/
PINTEREST
PINTEREST
INSTAGRAM

You may also like...

Leave a Reply

Your email address will not be published.

Enjoy this blog? Please spread the word :)