Change super-user, how?

All Gurus once were Newbies
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Please stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions prefer the other forums within the support section.
Before you post please read this

Change super-user, how?

Postby yonnie on Mon Dec 31, 2012 4:45 pm

I take older computers and install LM onto them and then give them to neighbors, grandkids and friends. I would like to find an easy way to remove the present administrator and put on the new owner. Presently I build the system for the owner which is impractical for a flea-market environ.

The only way to do this I've found so far is to re-install the whole system which is a real PITA! Is there a quick easy method for this?
You have your way. I have my way. As for the right way, the correct way, and the only way, it does not exist.”
- Friedrich Nietzsche
User avatar
yonnie
Level 2
Level 2
 
Posts: 80
Joined: Mon Jan 03, 2011 12:18 am

Linux Mint is funded by ads and donations.
 

Re: Change super-user, how?

Postby karlchen on Mon Dec 31, 2012 6:02 pm

Hello, yonnie.

There is no need to re-install Linux Mint in order to establish a new user account who replaces the old administrator user.
Logged in as the old administrator user create a new user account.
Make sure the new user is a member of the following user groups:
Code: Select all
$ grep newadmin /etc/group
adm:x:4:newadmin
cdrom:x:24:newadmin
sudo:x:27:newadmin
dip:x:30:newadmin
plugdev:x:46:newadmin
lpadmin:x:109:newadmin
sambashare:x:127:newadmin

Note:
The two group membershipts that make the new admin user an admin user are the memberships in the groups "sudo" and "adm".

Once the new account has been created and configured (see above), login as the new admin user.
Make sure you can perform all administrative tasks successfully.
Make sure you can use the "sudo" command successfully and execute things with root privileges.

Once this is the case and no sooner (!!!), remove the previous admin account or simply take away his membership in the groups "adm" and "sudo" thus degrading him to a normal user account.

Kind regards, and a happy new year,
Karl
User avatar
karlchen
Level 11
Level 11
 
Posts: 3761
Joined: Sat Dec 31, 2011 7:21 am

Re: Change super-user, how?

Postby yonnie on Thu Jan 03, 2013 2:59 pm

Hey thanks and Happy New Year to you too!

Not sure if it makes much difference but there is no /etc/group folder on this machine. The rest of the stuff you mention does make sense and is an angle I haven't tried yet, a lot to remember, I'll need to make a list! The problem I was having seemed to mostly orient around owner id which was 1000?, and root was 0? I forget as this was several days ago. I tried making a new user, giving the new user admin powers, but could not get rid of having to use the original password for admin purposes. Kept having the change password prompting with an error message everytime I tried to change it to be the same as the new user. And after I deleted the original user, I could not then alter that password, even though the new user had SU powers.
You have your way. I have my way. As for the right way, the correct way, and the only way, it does not exist.”
- Friedrich Nietzsche
User avatar
yonnie
Level 2
Level 2
 
Posts: 80
Joined: Mon Jan 03, 2011 12:18 am

Re: Change super-user, how?

Postby karlchen on Sat Jan 05, 2013 9:49 am

Hello, yonnie.

Not sure if it makes much difference but there is no /etc/group folder on this machine.
/etc/group is a file, not a folder.
You can verify it is by executing
Code: Select all
cat /etc/group


The user root will and must always have the user Id 0. Correct.
The first user created during the installation will always have the user ID 1000. Correct.
The next user will be assigned the user ID 1001 and so on.
Users which are system users will be assigned IDs clearly below 1000. This is by design.

Changing the root password:
  • Login using your new account name. Hopefully he really is a member of the groups "sudo" and "adm".
  • Open a terminal session.
  • Make this a root session by executing
    Code: Select all
    sudo -i
    Type in your user password when prompted.
  • Execute
    Code: Select all
    passwd
    Type in the old root password. Type in the new root password. Type in the new root password. This should be all.
  • Exceute
    Code: Select all
    exit
    to terminate the root session.
  • Exceute
    Code: Select all
    exit
    again to terminate the terminal session.

Kind regards,
Karl
Last edited by karlchen on Thu Jan 10, 2013 10:34 am, edited 1 time in total.
User avatar
karlchen
Level 11
Level 11
 
Posts: 3761
Joined: Sat Dec 31, 2011 7:21 am

Re: Change super-user, how?

Postby yonnie on Tue Jan 08, 2013 1:24 pm

Karlchen, thanks for the help and sorry about the delay in getting back to this.

Your commands work just fine, except they don't ditch the old guy and put in the new guy. They just change the password of the old guy. Also, when making a new administrator, in the users and groups gui, the new guy is still user id 1001 even though he has been given admin powers and the old guys password is still required. Reboot does not change this. The old guy has been given a new password, which should effectively lock him out, but any changes requiring admin powers still asks for old-guys password by name.

The old-guy got fired, the staff would like to forget about him, how can I make it like he was never here?

Also, another issue with changing password/user. When trying to log-in to package manager as new-user with admin powers, the new-guy password failed, the old-guy password failed and the old-guy old password failed.
You have your way. I have my way. As for the right way, the correct way, and the only way, it does not exist.”
- Friedrich Nietzsche
User avatar
yonnie
Level 2
Level 2
 
Posts: 80
Joined: Mon Jan 03, 2011 12:18 am

Re: Change super-user, how?

Postby karlchen on Wed Jan 09, 2013 1:25 pm

Hello, yonnie.

Now things are getting tricky, provided this is a company machine, because you cannot be expected to post files like /etc/passwd, /etc/group and /etc/sudoers publically in such a case. Yet, these files would be the first files which I would inspect in order to find inconsistencies. Actually I would have a peek at /etc/shadow as well (you need root privileges to do so).

By the way, the ID 1001 is perfectly all right. The first user on a system, except the system users, will have the ID 1000, the second user has got the ID 1001, the third user 1002 and so on.
The user ID itself does not make a user an admin user or prevent him from being an admin user. It is the membership in the relevant groups, sudo, adm, which grants the right ot act as root user temporarily.
This privilege can be granted to more than a single user on a given system.
Granting a user the privilege to act as root does not change his/her user ID. If you have manually tinkered with the user ID this will be the point where things started to go wrong.

If this is a company machine, the best thing which you can do may be finding a local Unix/Linux expert whom you can trust and have him investigate the problem.

Kind regards,
Karl
User avatar
karlchen
Level 11
Level 11
 
Posts: 3761
Joined: Sat Dec 31, 2011 7:21 am


Return to Newbie Questions

Who is online

Users browsing this forum: Google [Bot] and 3 guests