Why a user isn't opening by its own name while giving it root privileges ?
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Why a user isn't opening by its own name while giving it root privileges ?
Hello all.Hope you are doing great! Coming into a point.. I have changed a user's privileges in Rhel 6.6 by making changes in the /etc/passwd file and setting particular user's UID and GID values to "Zero"(as it is for root) so that , that particular user perform some important tasks like .. changing other user's password ..etc . After changing it. When I type su (switch user) command followed by that particular username, it is opening as root not as a that particular user.. Please enlighten me on this topic.Thanks
Last edited by sunilchand; 01-24-2017 at 11:00 AM.
One would also question your motives behind touching the /etc/passwd file? Also, do you understand what the 'U' in UID stands for, because if you do, you would know that assigning it to another user is highly problematic and violating the constraint.
One would also question your motives behind touching the /etc/passwd file? Also, do you understand what the 'U' in UID stands for, because if you do, you would know that assigning it to another user is highly problematic and violating the constraint.
Yes I know dear... But as I am new to Linux and was experimenting it on my own Laptop to learn how it works.. That's why I was asking about it.. The main motive for doing this, just to learn how it works.. Nothing else.
I have changed a user's privileges in Rhel 6.6 by making changes in the /etc/passwd file and setting particular user's UID and GID values to "Zero"
Don't do that. That's not how you "change a user's privileges", all it does is screw up the UID/username mapping as you've seen first hand. Regular users aren't root for a reason. If you want to be root, su to root.
In addition, when you change the UID/GID to zero and when you login for all effective purposes that user is root. As suggest by others if you want to give a regular user a particular privilege you should use sudoers
Yes I know dear... But as I am new to Linux and was experimenting it on my own Laptop to learn how it works.. That's why I was asking about it.. The main motive for doing this, just to learn how it works.. Nothing else.
As others have pointed out, this is not walking before running, this is flying at lightspeed straight for the sun.
It would also seem to be a very unusual first thing to want to experiment on.
As suggested, either use su as designed or investigate the sudo option
Location: Montreal, Quebec and Dartmouth, Nova Scotia CANADA
Distribution: Arch, AntiX, ArtiX
Posts: 1,363
Rep:
Quote:
Originally Posted by sunilchand
Hello all.Hope you are doing great! Coming into a point.. I have changed a user's privileges in Rhel 6.6 by making changes in the /etc/passwd file and setting particular user's UID and GID values to "Zero"(as it is for root) so that , that particular user perform some important tasks like .. changing other user's password ..etc . After changing it. When I type su (switch user) command followed by that particular username, it is opening as root not as a that particular user.. Please enlighten me on this topic.Thanks
.. I echo the warnings and advice above, however, in response to your question, the UID (user ID) and GID (group ID) are the >>>real<<< underlying values of the user and group IDs, the way the system recognizes them. So, having made the (inappropriate) changes you described to the /etc/passwd file, you have effectively told your system that when you use the username you are referring to, either directly or through the su command, you are indeed using root.
As suggested by many already, the sudo command is the way to go for most cases requiring alternate user privileges.
Expanding on Rickkkk, usernames are just human friendly labels (see also eg DNS names).
In reality its all done with numbers.... and 1st entry in /etc/passwd with uid/gid = 0 is 'root'.
As mentioned above, don't do that
Use either su or sudo depending on what you want .....
Expanding on Rickkkk, usernames are just human friendly labels (see also eg DNS names).
In reality its all done with numbers.... and 1st entry in /etc/passwd with uid/gid = 0 is 'root'.
As mentioned above, don't do that
Use either su or sudo depending on what you want .....
Yes, I understand that it's not good to change uid and gid value. It's rather to choose "Sudoers" file for the same.I have changed privilege of any user by editing this User1 ALL= (ALL: ALL) ALL.. Something like that.. But I want this command for some specific command not for all command.. How to do that?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.