Solved

Give Normal User Root Access in RedHat

Posted on 2015-01-13
9
315 Views
Last Modified: 2015-04-14
Hi Experts!

I need to add a normal user so when they log in they have the same permissions as root.  I've tried a couple of methods but do not think it's working when I log in as that user.

I've used:  vim /etc/passwd and have tried to change their numerical values to 0 but for some reason it's not saving that change and keeps reverting back to the old permissions that it was.  

I don't want them to have to su <username>, I'd just like this normal user to log in and automatically have root privileges.   Obviously, I normally wouldn't do this with my user accounts but this user is okay to have the this level of permissions.  

Thanks for any help you can provide with this!
0
Comment
Question by:itsmevic
  • 3
  • 2
  • 2
  • +2
9 Comments
 
LVL 12

Assisted Solution

by:Kent W
Kent W earned 83 total points
ID: 40547766
Add the user to your "wheel" group in /etc/group
0
 
LVL 19

Assisted Solution

by:NickUpson
NickUpson earned 83 total points
ID: 40547768
This is a really bad idea, in general but

usermod -o -u 0 loginid
 
(thats a zero not letter O)
0
 
LVL 77

Assisted Solution

by:arnold
arnold earned 84 total points
ID: 40547884
To allow a user to have root privileges, add the user to /etc/sudoers

the user can then elevate their rghts through the use of sudo.

presumably once a user has root level access as others pointed out the user can do anything on the system.

sudo allows you to limit the condition under which the user can have elevated rights.

what do you expect thi user to do that you are willing to give the person root rights?
0
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
LVL 12

Expert Comment

by:Kent W
ID: 40547888
@arnold

OP said -
"I don't want them to have to su <username>, I'd just like this normal user to log in and automatically have root privileges."
0
 
LVL 77

Expert Comment

by:arnold
ID: 40547965
mugojava,

I saw your response and NickUpson's.

Presumably the reason su - is not desired because then the asker would need to provide the user the root's password.

Sudoers, does not require that. depending on the sudoers configuration the user would or would not be prompted for their own password to elevate their rights.
0
 

Assisted Solution

by:Douglas Santos
Douglas Santos earned 167 total points
ID: 40549338
@itsmevic

I think that the better thing is configure the sudoers without request the password like that.

Where %sudo is the group that you enable the access like root.
visudo -> this is call the /etc/sudoers for your configuration.

Add the follow line our create that.

%sudo ALL = NOPASSWD: ALL

After that put your user in group like that

useradd -G sudo username.

When you need to use something with root access you can use

sudo command_line

or

you could use something like that

sudo su -

Where your user will work like root without asking root password or your credentials again.
0
 
LVL 77

Expert Comment

by:arnold
ID: 40549430
sudo su -  what is the point?

would it not be the same as running sudo bash? or sudo any_other_shell?

sudo elevates the shell to root user, the user will be root on the system without the need for root password. Possibly the root users profile settings might not be available.
0
 

Accepted Solution

by:
Douglas Santos earned 167 total points
ID: 40549457
The point here is the sudo for call the sudoers and check if the user or the groups has access the execute some kind of command the su if we want to call other user for e.g:
su - douglas
I'll call the bash as douglas user.

the flag - is for call the variables for the user account like .bashrc .bash_profile and stuffs like that.

if I only call sudo /bin/bash or sudo /bin/sh I'll execute the bash like the current user.

If I call sudo su - I'll execute the shell as root and with their variables.

That's why.


The point of the account elevates the shell to root user without the root password might be possible or not. it's depends of the sudoers configuration.

we can configure it to execute only some kinds of commands or all of them.
0
 
LVL 28

Assisted Solution

by:serialband
serialband earned 83 total points
ID: 40549742
sudo su - is redundant

Use
sudo -i
as specified in the man page.
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

The purpose of this article is to demonstrate how we can use conditional statements using Python.
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question