I was running visudo and i think i messed a lil up next time i booted it does no longer accept my password and am locked out, i can use ctrl alt 3 and get into user:root
but not my main profile so i can acces root shell, and i don’t know what too do
Maybe we should be looking at providing advice to the OP on the assumption that it is their /etc/sudoers file they were working on?
After all, they do mention sudoers in the topic title, and visudo defaults to editing /etc/sudoers if no file is specified, as I just tested on my system:
sudo visudo
[sudo] password for scotty:
visudo: /etc/sudoers.tmp unchanged
Of course, I exited without saving by typing :q! & pressing enter. However, if they mistakenly saved when exiting, they have probably overwritten their sudoers file, and thus find themselves locked out of sudo.
However, as a solution may be time-consuming, it would still be preferable for the OP to confirm what file they were working on.
If that isn’t possible, could they log in to a TTY session as root, delete their messed-up /etc/sudoers file, and then (as root) reinstall sudo to provide the default /etc/sudoers file? Or would that cause other issues?
This is something I was actually pondering recently when I tried to edit my sudoers file for the first time using visudo. It ended up with a lot of "q"s & other letters scattered throughout it as I tried to work out how to exit, and I had to do a search in Firefox for how to exit visudo without saving.
That was when I also discovered the much safer method of dropping a config file into /etc/sudoers.d/ rather than editing the actual sudoers file.
At this point we could guess a number of possibilities. Until the OP actually confirms what they have done; which file(s) they have edited; and/or provides some actionable information to work with, there’s practically nothing to be done here.
If the OP won’t help themselves within a fair amount of time, then I move to close.