Changed root pw with root account disabled and now my password isn't recognized

I have quite a hard situation on my hands.

I was trying to fix an unrelated issue, when one site with a similar issue to mine suggested it could fixed with usermod -aG input myusername…but forgot the a flag. I managed to remove myself from the sudoers.

I followed this: How to Reset the root Password :: Fedora Docs

Thinking I could just fix it via the root command line, but usermod isn’t available there. I thought that if I change the root password, I boot normally, drop down to terminal screen, and login as root. Not only did I forget that I have root disabled, now I can’t login to my user account either through gdm or a terminal login.

I have tried manually editing /etc/group to add my account back into wheel, and have tried changing my password from the root terminal I used to to change my root password.

I made sure to touch /.autorelabel before rebooting each time I used the recovery root terminal mentioned in the link above.

I have been searching for hours how to fix this, and I have ran out of ideas. What else can I try to get my ability to login back?

1 Like

At step 6, instead of passwd, can you use passwd yourusername? Also, for changing group membership, I use gpasswd instead of usermod:

gpasswd -a $USER input

This will add logged in user to the input group. Argument after the -a option specifies the username to be added to the group at the last argument.

2 Likes

Did this, followed by touch /.autorelabel and now the CUPS Scheduler won’t start. Normal booting now fails.

I have figured out that my initial unrelated issue to which I ran usermod for can’t be fixed by adding myself to the input group.

Right now, I am trying to reverse whatever the mistyped command and trying to change the root pw did, but to no avail.

I removed myself from input and wheel with gpasswd -d username input and gpasswd -d username wheel and still can’t boot.

Hit escape on plymouth and it looks like several services no longer have permission to run.

I don’t want to add myself to input. I just want to get back to being able to boot and login, and I am not sure what to look at or what to run despite my best googling

Added cups, password, root, selinux, wheel

This guide shows how to set a forgotten root password.
See https://linuxconfig.org/recover-reset-forgotten-linux-root-password

It shows setting the root password.
But you can also set your user password with passwd <username>.

I found it a bit hard to understand the situation.

It would be cool to use some markdown headers, bullet points etc to make it clearer.

Accidentally changing the root password could be a good candidate for the “common issues”.

  • what user setup do you have
  • what was the exact problem
  • what did you do
  • was your user in wheel
  • what is broken
  • what is the fix for the issue
  • alternative fixes for stuff that does not work (like gpasswd instead of usermod)
2 Likes

Note: first time daily driving Linux in 12 years.

*I have one user account on this system. If there are an config files that would useful to post, I can post any config relevant to users, permissions, user setup, or anything requested.
*the problem was that I could no longer login into my system. Trying a solution added an additional issue
*Now, Several services daemons don’t have the permissions to start:



What I did:

  1. ran usermod -G myusername input
  2. rebooted and found both gdm and terminal logins reject my password
  3. followed this guide: How to Reset the root Password :: Fedora Docs modified the line with linux and added rw init=/bin/bash to the end
  4. booted with f10, and ran passwd, changed the password. It said it changed it successfully
  5. ran touch /.autorelabel followed by /sbin/reboot -f.
  6. attempted a normal, got to the gnome login screen, clicked my username, and entered my password, which it said was wrong[/li]
  7. re-entered my password several times, being very careful, and it kept saying it was wrong.
  8. Dropped down to a terminal through ctrl+alt+f3, tried logging in, and it still said the pw is wrong
  9. Repeated step 3
  10. ran passwd -d username, this it was successful, I and repeated step 5
  11. Clicked on my username and hit enter (seeing as my password should have been deleted in step 10). It told me my password was wrong
  12. Repeated step 3
  13. Ran passwd -d root(I realize this was stupid to run this), it said it was successful, and I repeated step 5
  14. At the login screen, selected ‘not listed’, entered ‘root’ as the username, and entered no password. It said the password was wrong.
  15. Tried the previous step after hitting ctrl+alt+f3 to access a tty. Same issue occured.
  16. Repeated step 3, ran passwd, changed the password (it said successfully), and repeated step 5
  17. Clicked ‘not listed’, entered the username root and entered the exact password I had just set. It said it was wrong. Tried a terminal login again with ctrl+alt+f3. It also said the password was wrong.
  18. Repeated step 3, ran gpasswd -a myusername input and gpasswd -a myusername wheel, repeated step 5
  19. Problem #2 started here, where multiple services won’t start (pictures above)
  20. Did step 3 again, ran gpasswd -d myusername input, repeated step 5, and booting failed in the same manner
  21. Did step 3 again, but this time I ran gpasswd -d myusername wheel, repeated step 5, and booting had the same issue

*my account was an administrator so it was in wheel

*no idea what is system or config file is broken, if that’s the question.

What I know:

  1. I couldn’t log in as myself after running usermod -G input myusername followed.
  2. Many services can’t start after running gpasswd -a myusername input, this prevents me from booting, and gpasswd -d myusername input doesn’t fix it

*I have no idea what command to run, config file to modify, or anything else about the source of the issue. All of those are variables.

*I have tried gpasswd, and it added an additional issue of many service daemons not able to start at boot, causing boot to fail

You removed groups from your username I think.
This shows what happens if the -a is not used.
(I run all this as the root user)

$ id barry
uid=1000(barry) gid=1000(barry) groups=1000(barry),10(wheel)
$ usermod -G input barry
$ id barry
uid=1000(barry) gid=1000(barry) groups=1000(barry),104(input)
# wheel is gone!
$ usermod -aG wheel barry
$ id barry
uid=1000(barry) gid=1000(barry) groups=1000(barry),10(wheel),104(input)
# -a added wheel and left input

Adding input to my user account did not break rebooting or logging in to KDE plasma.

Use id username to show what groups you have setup.

2 Likes

I am stuck in a live session transferring my files to a portable hard drive, in case I need to reinstall, and can’t find a way via google to use id on my installed system user via the live session.

I apologize if the following is of no use, but the following in my group file:

root:x:0:
bin:x:1:
daemon:x:2:
sys:x:3:
adm:x:4:
tty:x:5:
disk:x:6:
lp:x:7:
mem:x:8:
kmem:x:9:
wheel:x:10:
cdrom:x:11:
mail:x:12:
man:x:15:
dialout:x:18:
floppy:x:19:
games:x:20:
tape:x:33:
video:x:39:
ftp:x:50:
lock:x:54:
audio:x:63:
users:x:100:
nobody:x:65534:
dbus:x:81:
apache:x:48:
utmp:x:22:
utempter:x:35:
tss:x:59:
printadmin:x:999:
input:x:104:
kvm:x:36:qemu
render:x:105:
sgx:x:106:
systemd-journal:x:190:
systemd-coredump:x:998:
systemd-network:x:192:
systemd-oom:x:997:
systemd-resolve:x:193:
systemd-timesync:x:996:
qemu:x:107:
polkitd:x:114:
avahi:x:70:
brlapi:x:995:
dip:x:40:
geoclue:x:994:
nm-openconnect:x:993:
usbmuxd:x:113:
gluster:x:992:
jackuser:x:991:
rtkit:x:172:
pipewire:x:990:
saslauth:x:76:saslauth
chrony:x:989:
dnsmasq:x:988:
rpc:x:32:
rpcuser:x:29:
openvpn:x:987:
nm-openvpn:x:986:
colord:x:985:
unbound:x:984:
libvirt:x:983:
abrt:x:173:
flatpak:x:982:
gdm:x:42:
gnome-initial-setup:x:981:
vboxsf:x:980:
power:x:979:
sshd:x:74:
tcpdump:x:72:
plocate:x:978:
gamemode:x:977:
michaelsherwin:x:1000:
wbpriv:x:88:
wsdd:x:976:
gnome-remote-desktop:x:975:
passim:x:974:

I don’t want to be redundant or annoying, but I need to emphasize that I am no longer trying to add myself to the input group. I don’t need to. I only brought that up because it was only after having ran usermod -G myusername input. I was trying to explain what I did before this issue occurred.

What I am trying to do right now

  • figure out why my booth services no longer have the permissions to start. If a dump of the boot log would be helpful, I can provide that.
  • figure out why my password was claimed to be incorrect at login prior to losing the ability to boot.

What I am not trying to do

  • Add myself to the input group

What I can’t do right now

  • Boot

What I don’t know

  • What part of the system/configuration is not permitting several services to not run

I can’t figure any of this out. I am currently re-installing fedora. Case closed

Here I explained what exactly went wrong:

In your case, if your user is moved just in one group, the solution from @ersen is not helping you. Because you are moving yourselves just to one group again.

Unfortunately “sudo usermod -G input myusername” is not preserving your existing elevated groups (like wheel) … just puts you in the group you ask for additionaly.

1 Like

Yes usermod has the argument -a meaning “append” and -G for “group”.

usermod -G GROUPNAME $USER will remove you from wheel and others.

Instead use usermod -aG GROUPNAME $USER

1 Like

Any user who fails to understand what a command may and should do (by reading the man page before using it) is asking for trouble when modifying users password, groups, etc.

The same applies by not understanding the current environment you may be in when executing commands.

In your post 8 above (which I quoted) you were currently running in single user mode as root and changed the root password. You did not change the password for your regular user.

Unfortunately the Manual is not actualized anymore for the Quick-Dock mentioned from the OP (until F36).
A actualized manual would be this here on Ostechnix

He not changed it, it has been deleted with -d parameter (step 10).
Login without PW is not possible by default.

On point 13 also the Root user got the pw deleted and got locked.

Quite a lot went wrong, incorrect manual and some commands to much where not have been listed.

Then there is a other quick doc about samba shares. There is definitely also a change needed to point out that usermod -G is just for new created users. If the user is in wheel and he does repeat the command to put him selves to the shared group.