[SOLVED by @rcxb one more question at bottom] HELP! Lost sudo privilege's AND root can't log in

Here’s the deal. I looked at my sudo file using “visudo”… I deleted a “%” sign on a line and removed my sudo privilege’s. I had removed root login functions before. I am now stuck without the ability to do almost anything with the system… I attempted to see if there is a boot option for recovery… This didn’t work because proxmox didnt have that option. I attempted to roll back to a diffrent version and because I had upgraded ZFS between versions the drives are unreadable.

Is there anything I can do? Use another system boot disk to edit files? I’m hoping I can fix this… but I’m fairly sure I’m SOL.

Im fairly sure I messed up the system, when I did the updates I also messed up the Nvidia passthrough as it cant see the card anymore. Versions must be diffrent or id changed.

FML. Now I’m going to catch hell for plex being down. Ugh…

Lesson learned: do NOT mess with files you don’t understand AND you have no way to recover stuff when things go haywire :stuck_out_tongue:
Anyway, there is a way out and yes indeed, it involves a different Linux OS to save your b#tt.

Get yourself a sysrescuecd iso image here. Create a bootable medium with it as per the instructions on the site, then boot your Proxmox system from that medium.

Next step is to create a mountpoint (suggest. /mnt/proxmox), then mount the OS drive there:
mount /dev/sda1 /mnt/proxmox
Assuming /dev/sda1 is the Proxmox OS disk. Locate the file you’ve modified and undo your changes. Save the file and reboot into Proxmox.

HTH!

3 Likes

Thank you for this. I’ll give it a try once I can get on it for a bit. I can’t for the life of me remember how I removed the ability to log in as root. I rechecked my playbook for my system and I didn’t write it down it seems so two lessons learned… thanks again and I’ll get back with results.

You can try changing the run level on the system during bootup, login as root, and then change roots password and then reboot.

1 Like

I’ll look into that too see if I can find a guide. My boot options are very limited as there’s no tools avalible only 3 versions of proxmox. I’ll have to see how to create a file prior to changes.

At the boot-up GRUB menu, hit E to edit. Mouse down to the 2nd of 3 lines, and at the end of the line type init=/bin/bash

You’ll boot-up to a shell. Then do:

mount -o remount,rw /
export TERM=vt100
export PATH=/bin:/sbin

Then you should be able to use vi, passwd, usermod, or whatever other basic commands you need, to fix your system.

1 Like

This worked perfectly. I was able to just redo my command I had record of visudo to open the sudoers file where I removed the % sign, put it back in, saved it and good to go. Thank you so much. It is common practice to remove root from being able to log in for security purposes correct? Or am I being too security consious for home use?

It’s good practice to remove any kind of remote login for root. I wouldn’t bother with disabling local root on a home machine. If an attacker gets physical access to your box it’s usually game over anyway.

2 Likes

OK thank you. Ill refresh how I did what I did to just limit it to REMOTE access. I’m doing some reading but I get confused sometimes thinking I found what I need in some rather technical documents. I try not to use any sources I dont trust or codes or edits I dont understand.

SOULUTION to missing root account- I must have deleted the password for root. This disabled all access to it even from the proxmox interface as a user.
sudo passwd root was all it took. I put in the new password twice and now I have local root access again. Thank you to all who tried to help, and I made notes of your suggestions just incase I screw up.

One last question. Does anyone know how to create or remove old restore points that are present at boot to choose from? That would be a great safety net. I had attempted to look that up before but I might have been using the wrong terminology to get a good search. Is there a way to add in a rescue option to proxmox boot like most debian releases?

You would want to use a COW type of file system like XFS + LVM + MD, ZFS, or BTRFS.

If you run SuSe, this is built into YaST’s update process. You can rollback snapshots to different points before and after system updates/package installations.