Search My Techie Guy

Saturday, November 12, 2016

Giving a normal linux user root(sudo) privileges

Summary: 

Giving a linux user root(sudo) privileges 

Problem or Goal:

Allowing a normal linux user sudo privileges

Cause: 

In most cases, you may want to grant some user on the linux system, root privileges.

Solution: 

1. Edit the /etc/sudoers file and add the user you wish to grant sudo right to this sudoers file. Take forexample the user "exampleuser"

# visudo

# more /etc/sudoers
#
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults        env_reset
Defaults        mail_badpass
Defaults        secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/
sbin:/bin"

# Host alias specification

# User alias specification

# Cmnd alias specification

# User privilege specification
root    ALL=(ALL:ALL) ALL
exampleuser ALL=(ALL:ALL) ALL

2. Save the changes
3. Now run the command "sudo su" when logged in as the exampleuser:

$ sudo su

4. Enter the exampleuser password, you will see the prompt changing to the one similar to root.

Problem Solved?

yes

No comments: