Accidentally Removed Myself From All Admin Groups...

If none of the more specific forums is the right place to ask

Accidentally Removed Myself From All Admin Groups...

Postby jrredho » 2017-08-30 15:48

Hey All,

Knucklehead that I am, I somehow neglected to add the '-a' argument to the usermod command when adding myself to another group and now no longer belong to all of the default groups that I was in after installing Stretch with sudo access only.

Would someone here be so kind as to instruct me on now the re-claim my membership in all of the default administrative groups, such as sudo, lpadmin, etc, that one is added to at install time?

Many thanks!

cheers,
john
jrredho
 
Posts: 13
Joined: 2015-03-03 18:00

Re: Accidentally Removed Myself From All Admin Groups...

Postby wizard10000 » 2017-08-30 15:58

Can't help you with group membership because I'm not on a Linux box but can tell you how to get root back -

* At the grub menu hit 'e' to edit kernel arguments.

* At the end of the line that starts with "linux", add
Code: Select all
init=/bin/bash
and hit Esc or F10 to boot.

* Now that we're in single user mode, mount your root filesystem read-write like this:
Code: Select all
mount -no remount,rw /


* Change root's password like this:
Code: Select all
passwd root


* Reboot and you should be able to use su to get things fixed.

Hope this helps -

edit: I can help after all. Thanks to rclone and gdrive I posted my /etc/group to http://paste.debian.net/983731

My username in the file is wizard and I'm a member of all the groups that contain that username - plus the group that *is* my username.
we see things not as they are, but as we are.
-- anais nin
User avatar
wizard10000
 
Posts: 1204
Joined: 2011-05-09 20:02
Location: everywhere i go, there i am!

Re: Accidentally Removed Myself From All Admin Groups...

Postby jrredho » 2017-08-30 16:17

Hey Wizard,

Thanks so much for the help!

But (there's always one of these, isn't there), unfortunately, that prompts a couple more questions:

(1) My root partition, and really all partitions other than /boot, are LVM2 logical volumes on a LUKS-encrypted disk partition. Will your process still work?

(2) Since I was advised, strongly iirc, during installation not to set a root account. How would I go back to that original setup?

Thanks again,
john
jrredho
 
Posts: 13
Joined: 2015-03-03 18:00

Re: Accidentally Removed Myself From All Admin Groups...

Postby wizard10000 » 2017-08-30 16:29

Hi, John -

jrredho wrote:(1) My root partition, and really all partitions other than /boot, are LVM2 logical volumes on a LUKS-encrypted disk partition. Will your process still work?


Do this instead -
Code: Select all
mount -ano remount,rw
that will remount all your filesystems RW and should work fine.

jrredho wrote:(2) Since I was advised, strongly iirc, during installation not to set a root account. How would I go back to that original setup?


When you're done change the root password back to a blank password and it'll disable root logins. Make sure sudo works before you do, though :mrgreen:
Code: Select all
sudo passwd root
and when prompted for a password just hit the enter key - and then hit it again when asked to confirm.

Good luck -
we see things not as they are, but as we are.
-- anais nin
User avatar
wizard10000
 
Posts: 1204
Joined: 2011-05-09 20:02
Location: everywhere i go, there i am!

Re: Accidentally Removed Myself From All Admin Groups...

Postby Segfault » 2017-08-30 16:48

When in single user mode you are root and can fix your user groups without setting root password.
Segfault
 
Posts: 499
Joined: 2005-09-24 12:24

Re: Accidentally Removed Myself From All Admin Groups...

Postby wizard10000 » 2017-08-30 16:51

Segfault wrote:When in single user mode you are root and can fix your user groups without setting root password.


Nice catch :mrgreen:
we see things not as they are, but as we are.
-- anais nin
User avatar
wizard10000
 
Posts: 1204
Joined: 2011-05-09 20:02
Location: everywhere i go, there i am!

Re: Accidentally Removed Myself From All Admin Groups...

Postby jrredho » 2017-08-30 17:02

Thanks, wizard, for all of your detailed help!

cheers,
john

ps You too Segway :)
jrredho
 
Posts: 13
Joined: 2015-03-03 18:00

[Solved]Re: Accidentally Removed Myself From All Admin Group

Postby jrredho » 2017-08-31 17:09

wizard10000 wrote:Can't help you with group membership because I'm not on a Linux box but can tell you how to get root back -

* At the grub menu hit 'e' to edit kernel arguments.

* At the end of the line that starts with "linux", add
Code: Select all
init=/bin/bash
and hit Esc or F10 to boot.

* Now that we're in single user mode, mount your root filesystem read-write like this:
Code: Select all
mount -no remount,rw /


* Change root's password like this:
Code: Select all
passwd root


* Reboot and you should be able to use su to get things fixed.

Hope this helps -

edit: I can help after all. Thanks to rclone and gdrive I posted my /etc/group to http://paste.debian.net/983731

My username in the file is wizard and I'm a member of all the groups that contain that username - plus the group that *is* my username.


Hey Wizard,

Just a quick followup: Since I the grub2 entry included the appropriate initramfs, which was aware of the LUKS/LVM thing, I followed these directions and accomplished exactly what I was trying to do. And having a template for admin-related default group membership really helped, too. Thanks again!

But there was one minor tweak: Disabling the root password access didn't work by setting it to *empty* using the method you suggested. The passwd command refused to accept it. Instead I had to to use the '-l' passwd option---and I'm still not positive that that accomplishes what I was hoping it would. *Sigh* There's always one more thing...

cheers,
john
jrredho
 
Posts: 13
Joined: 2015-03-03 18:00

Re: Accidentally Removed Myself From All Admin Groups...

Postby wizard10000 » 2017-08-31 17:51

My mistake. To remove the root password do this -

Code: Select all
sudo passwd -d root


hth -
we see things not as they are, but as we are.
-- anais nin
User avatar
wizard10000
 
Posts: 1204
Joined: 2011-05-09 20:02
Location: everywhere i go, there i am!

Re: Accidentally Removed Myself From All Admin Groups...

Postby Segfault » 2017-08-31 18:27

Some folks just love doing things the hard way. I can think of even more difficult way to edit user groups, you wanna hear it? It involves chrooting and much more! I guarantee you will be fiddling for hours, that's what you enjoy, right?

Sorry, couldn't help, I'm a big fan of common sense myself. 8)
Segfault
 
Posts: 499
Joined: 2005-09-24 12:24

Re: Accidentally Removed Myself From All Admin Groups...

Postby jrredho » 2017-08-31 18:58

Segfault wrote:Some folks just love doing things the hard way. I can think of even more difficult way to edit user groups, you wanna hear it? It involves chrooting and much more! I guarantee you will be fiddling for hours, that's what you enjoy, right?

Sorry, couldn't help, I'm a big fan of common sense myself. 8)


If only there had been a way for you to have impacted that in this case...
jrredho
 
Posts: 13
Joined: 2015-03-03 18:00

Re: Accidentally Removed Myself From All Admin Groups...

Postby Segfault » 2017-08-31 19:48

Yes, I told you not to mess with root password because it is not necessary. Once booted in single user mode all you had to do was to use a tool like vigr to fix your user account. But of course, no one can help people who do not listen.
Segfault
 
Posts: 499
Joined: 2005-09-24 12:24

Re: Accidentally Removed Myself From All Admin Groups...

Postby jrredho » 2017-08-31 21:28

Segfault wrote:Yes, I told you not to mess with root password because it is not necessary. Once booted in single user mode all you had to do was to use a tool like vigr to fix your user account. But of course, no one can help people who do not listen.


Yeah, I tried that, and guess what? It didn't work. To be fair, I used usermod directly since using a tool like vigr would've required me to know something about vi, and to know that such a tool as vigr existed in the first place. When I used usermod, I got complaints from the command with the net assessment being that it didn't update my groups. Go figure; I honestly don't know what state I'd put myself in. So I decided to do it the long way, rebooted su root'd then used usermod with no issues. As I mentioned I then reset the root password.

I think all of this means that I've now given you free license to feel twice as smug as you originally did, since now you know that it took me twice the effort than you thought it had. You should be thinking about buying me a beer!

john
jrredho
 
Posts: 13
Joined: 2015-03-03 18:00


Return to General Questions

Who is online

Users browsing this forum: No registered users and 4 guests

fashionable