Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 825
  • Last Modified:

root privileges ....

I haven't found anything on linux  that helps me answer this question. I was wondering what the command would be in linux to add a profile for my roommate that has root privileges when he logs in right off the bat without having to su in? So basically I want to create a profile that has root privileges. Would it be something like: adduser someName ...how do I address the root privileges?

Thanks!
0
redgorilla2
Asked:
redgorilla2
1 Solution
 
owensleftfootCommented:
After you have created your friends username, edit /etc/passwd and change his uid to 0.
0
 
mbarbosCommented:
gid also...
0
 
redgorilla2Author Commented:
I changed it to the following

userName:x:0:0

but then upon logging in again, apparently the previous password is no longer valid (after trying both the orinigal user profile password and the root password). Why is that and how do I fix it? Thanks.
0
Restore individual SQL databases with ease

Veeam Explorer for Microsoft SQL Server delivers an easy-to-use, wizard-driven interface for restoring your databases from a backup. No expert SQL background required. Web interface provides a complete view of all available SQL databases to simplify the recovery of lost database

 
GnsCommented:
Um, I hope that isn't the complete pwentry...:-)

It should work. I've just tested it on a RH8 box with shadow passwords (like you seem to be using)... works like a charm.
Not that I'd recommend this setup. root priveledges should be "cumbersome" to get;-). In most cases sudo is very much to be preferred.

Some systems might have a problem with /bin/login though.

If he really wants to run as root, well then ... have him run as root instead.

-- Glenn
0
 
GnsCommented:
One problem with "multiple users with the same UID" is that when you are logged in as that user and change the password, you will change the apssword for the first occurence of the _UID_, unless you do "passwd <username>" of course.
I would guess that you either "damaged" the passwd-file entry for the user, or you first edited him/her to be "secondary root" and the su'd to userName and changed the password (on the wrong account).

this is just one reason to not have multiple users (or username handles) for the same UID.

-- Glenn
0
 
haydes007Commented:
you could try sudo
0
 
redgorilla2Author Commented:

I think your right about damaging the password. I think that's what happened.

What is the difference between logging in directly as root and su'ing in?


Isn't running sudo the same as having the ability to su in? I can run root commands from the command line with either one, right?
0
 
redgorilla2Author Commented:

I think your right about damaging the password. I think that's what happened.

What is the difference between logging in directly as root and su'ing in?


Isn't running sudo the same as having the ability to su in? I can run root commands from the command line with either one, right?
0
 
GnsCommented:
The difference is in what files get read at shell startup, mostly (this is an oversimplification:-).
If you do just "su<Enter>", the environment of the user su is executed from will be more or less preserved. If you do "su - <user>" su will fake a login (and read profile etc). This is not only true for su'ing to root, but to any user.

There seem to be so little difference between sudo and su, but they are eons apart.
sudo is a way to give root privs without disclosing the root password... and keep some control on exactly what the "sudoer" is allowed to do.
sudo will ask for the users password and "cache" this authentication for a short while (default behaviour, you can change how it works in /etc/sudoers).
Read
man sudo sudoers visudo

Q&D:
just copy the line for root in /etc/sudoers and change the name to the intended "rootpriv" username.
example:
# User privilege specification
root    ALL=(ALL) ALL
glenn   ALL=(ALL) ALL

-- Glenn
0
 
redgorilla2Author Commented:
Thanks Gns! You helped me a lot!
0

Featured Post

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now