I locked myself out of sudo privileges, anyways to save myself?
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.
I locked myself out of sudo privileges, anyways to save myself?
I have been having a GREAT DAY.
I was messing around with Ardour today, but I had no audio output, I thought it had something to do with not having JACK, I decided to follow a tutorial and did so, but that didn't fix it and I actually lost all audio to my whole system, so I decided to undo all that I did, one of the step was to add my user account to a special music group, 5 minutes after finding out how to remove myself from it and doing it, I found out I had lost my sudo privileges, and I am the only user on the system. I looked up tutorials to fix this but all of them required me to get access to the root shell, which I can't because when I boot into the systemmd-boot, I don't have an option to get to recovery, any help with me just being able to get back my system without having to start over?
I use PopOS 21.04
I have a dell XPS 12-9q33(if that's relevant)
any help would be appreciated
If you mount the main hard drive, there will be a file etc/group inside the mount point. Find that and make a copy of it called etc/group.orig or something. Then edit etc/group on the line starting with "sudo" by appending your account name on the line. If there is already something on that line, put a comma in between the names.
Code:
...
sudo:x:127:disaster2life
...
Or, if there is already one or more members of the group, add a comma:
Code:
...
sudo:127:foo,bar,disaster2life
...
Either way, everything to the left of the last colon should be left alone.
Edit: there is also the file gshadow which should get the same treatment, for thoroughness, but the above is the minimum for that approach. chroot is another way.
Last edited by Turbocapitalist; 09-17-2021 at 12:30 PM.
It may be simpler to boot single user mode and attempt to set a root password. Reboot, log in as root and do whatever needs to be done. The sudoers file may be misconfigured.
"Tutorials" are supposed to teach - many do not. They often consist of a set of, possibly outdated, instructions which may not be the best approach.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.