LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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


Reply
  Search this Thread
Old 10-20-2019, 05:27 PM   #1
gebees
LQ Newbie
 
Registered: Oct 2019
Posts: 6

Rep: Reputation: Disabled
Cannot use sudo after changing my user password. Cannot access root in any other manner either.


I am running Mint 18.1 on a Toshiba Satellite P75-A and access grub bootloader via ESC at boot. My username is no longer a member of sudo group though it is a member of adm. I am the only user of this computer, and my network is a home network with ethernet and wifi and, typically, only one other user.
 
Old 10-20-2019, 05:35 PM   #2
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,150

Rep: Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856
use a live cd or similar boot using it and reset your user password google to find exact solution for your distro
 
1 members found this post helpful.
Old 10-20-2019, 06:03 PM   #3
Firerat
Senior Member
 
Registered: Oct 2008
Distribution: Debian sid
Posts: 2,683

Rep: Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783
the problem is not with the password
it is the fact the the membership of sudo group is lost

I assume
Code:
usermod -G adm gebees
the problem is, -G on its own flushes all other group memberships

man usermod
Quote:
-G, --groups GROUP1[,GROUP2,...[,GROUPN]]]
A list of supplementary groups which the user is also a member of. Each group is separated from the next by a comma, with no
intervening whitespace. The groups are subject to the same restrictions as the group given with the -g option.

If the user is currently a member of a group which is not listed, the user will be removed from the group. This behaviour can be
changed via the -a option, which appends the user to the current supplementary group list.

to fix, you need to boot a liveCD, mount the root partition, chroot to it and then fix the users group

there was a similar thread not so long ago, I'll see if I can find it
 
3 members found this post helpful.
Old 10-20-2019, 06:16 PM   #4
Firerat
Senior Member
 
Registered: Oct 2008
Distribution: Debian sid
Posts: 2,683

Rep: Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783
I was hoping I could find it quickly, but no

the reason I wanted to link it was I think they managed to get to root account by booting recovery mode from grub
Which is easier than my suggestion of chroot with a liveCD
 
1 members found this post helpful.
Old 10-20-2019, 06:28 PM   #5
Firerat
Senior Member
 
Registered: Oct 2008
Distribution: Debian sid
Posts: 2,683

Rep: Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783
found it

see @michaelk post for how to readd sudo

https://www.linuxquestions.org/quest...5/#post6029860
 
3 members found this post helpful.
Old 10-20-2019, 07:34 PM   #6
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
go live use that root user to do what you got a do.
 
Old 10-20-2019, 07:50 PM   #7
gebees
LQ Newbie
 
Registered: Oct 2019
Posts: 6

Original Poster
Rep: Reputation: Disabled
title the reply...?

I've just gotten ready to try the boot-from-ISO solution. This method gets me directly to my current user name and allows me to work on it without any other password. Thanks for that.
 
Old 10-20-2019, 07:58 PM   #8
Firerat
Senior Member
 
Registered: Oct 2008
Distribution: Debian sid
Posts: 2,683

Rep: Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783
you need to thank @michaelk in the other thread

I had always assumed that the recovery from grub method prompted you for password

I have a memory of needing root password when a boot failed and I needed to enter maintenance mode
 
1 members found this post helpful.
Old 10-20-2019, 10:36 PM   #9
gebees
LQ Newbie
 
Registered: Oct 2019
Posts: 6

Original Poster
Rep: Reputation: Disabled
In using the Mint 18.2, Cinnamon 64 bit ISO to boot from USB stick, I found that, sadly, I could not read my hard drive such that my booted OS could work in any way with any user management commands such as adduser, passwd, users etc. Nor was sudo useable with my login credentials. Anyway, researching more, trying again.
Help I've received has clarified and expanded my work to fix this issue. Thanks. Any further ideas are welcome.
 
Old 10-20-2019, 10:53 PM   #10
Firerat
Senior Member
 
Registered: Oct 2008
Distribution: Debian sid
Posts: 2,683

Rep: Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783
did the boot to recovery not work?

I have quoted the post I linked earlier

you should replace g41m-combo with your user name

if the below does not work, I can probably walk you through chroot via a liveCD


Quote:
Originally Posted by michaelk View Post
To elaborate as far as I know the only way to accomplish the above is boot into recovery mode and select drop to a root shell prompt. The root partition is mounted but as read only. To mount it read/write use the mount command.

mount -o remount,rw /

To restore sudo group

adduser g41m-combo sudo

To quit recovery mode type exit and then reboot.

I have not booted into recovery mode in a long time so I can't not confirm exact wording of recovery mode. I also assume that Mint works the same as Ubuntu.
if the above fails

I'm guessing Mint is lvm2 and not "traditional" partitions
to confirm I will need to output of

Code:
lsblk
you won't need root to run that, ( and it should be installed by default )
 
1 members found this post helpful.
Old 10-21-2019, 11:34 AM   #11
gebees
LQ Newbie
 
Registered: Oct 2019
Posts: 6

Original Poster
Rep: Reputation: Disabled
Boot to recovery did not work, password required...

I booted from an ISO of my Mint as well. No happiness there because I could not chroot, if that makes sense, and when I ran fdisk -l, the booted OS was denied access,'...permission denied.' I'm thinking of attempting the ISO boot with an Ubuntu ISO. It seems that the Ubuntu OS may have more luck with the fdisk -l and the chroot. Regarding the boot to recovery 'failure', I believe that I had set a root password some time ago, but the password that I remember does not work when- and wherever I attempt to use it.
 
Old 10-21-2019, 11:40 AM   #12
gebees
LQ Newbie
 
Registered: Oct 2019
Posts: 6

Original Poster
Rep: Reputation: Disabled
results of lsblk...

~ $ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sr0 11:0 1 1024M 0 rom
sda 8:0 0 698.7G 0 disk
├─sda2 8:2 0 690.2G 0 part /
├─sda3 8:3 0 7.9G 0 part [SWAP]
└─sda1 8:1 0 512M 0 part /boot/efi
 
Old 10-21-2019, 12:05 PM   #13
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
chroot just do not do the install-grub part and try dealing with your issue how ever it needs to get done, remember to change the parts that reflect your system.

https://zeldor.biz/2010/12/install-grub-from-chroot/

efi grub stuff jic
https://wiki.debian.org/GrubEFIReinstall

Last edited by BW-userx; 10-21-2019 at 12:07 PM.
 
Old 10-21-2019, 12:11 PM   #14
Firerat
Senior Member
 
Registered: Oct 2008
Distribution: Debian sid
Posts: 2,683

Rep: Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783
yeah, you need root

https://linuxmint-installation-guide...e-live-session

ok, so it isn't lvm ( I assumed that was the default ( like CentOS ) these days, I guess it is still optional )

boot your live CD and open a terminal

Code:
mkdir /tmp/mnt
sudo mount /dev/sda2 /tmp/mnt
# no password, see link above just hit enter 
sudo chroot /tmp/mnt
# you should now be root on your install!
adduser yourusername sudo
exit # to get out of the chroot
sudo umount /tmp/mnt
then reboot

you should now have access to sudo once more

consider adding your username
Code:
sudo visudo
Code:
<snip>
# User privilege specification
root    ALL=(ALL:ALL) ALL
copy that root line, subsituting your username
this way should you lose sudo group membership you can still use sudo

you might also like to think about adding a password for root
Code:
sudo passwd root
but since you have explicitly added your username to sudoers you should not need that

Last edited by Firerat; 10-21-2019 at 12:13 PM.
 
1 members found this post helpful.
Old 10-21-2019, 12:28 PM   #15
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
that last part, I'd add root passwd this way one can still get in via root in case user cannot.
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] sudo to user other than root but do not allow sudo to root Westmoreland Linux - Security 4 07-13-2022 01:09 PM
[SOLVED] sudo password different from non-sudo password edrom Linux - Newbie 2 04-20-2012 03:00 PM
sudo password not same as root password - ubuntu 11.04. hence can't access partitions daudiam Linux - Newbie 1 09-03-2011 11:02 AM
Kmail won't retrieve e-mail. Doesn't to the request in any manner. cwizardone Linux - Software 1 08-17-2008 08:05 PM
How do I use sudo for my LPA's in a secure manner lucky_dev36 Linux - Security 1 08-31-2005 08:19 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:23 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration