Hi, I have added superuser and a standard user in a group, then logged out and logged in, and my admin user become standard user, and now I can’t do anything.
That really shouldn’t happen. Can you please provide more information on what you did and how you went about it? Exact commands would be most helpful since they let others run them to see if they can replicate the issue that you are reporting.
hi,
Open TERMINAL and type sudo -i, enter your user password.
Now you’re root and type passwd to change root password.
Hope it helps.
Regards
The last commands were
976 sudo groupadd music
977 sudo adduser karen music
978 sudo usermod -G music karen
979 sudo usermod -G music pizzapablo666
980 id
981 members music
982 sudo yum members
983 sudo dnf install member
984 member music
985 id
986 su karen id
987 su -c karen 'id'
pizzapablo666 is not in the sudoers file. This incident will be reported.
Perhaps you were bitten by this? From man usermod
:
-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.
Did you use -a
to append to the userlist?
(In general, when playing around—it’s best to not use your general user but to create a test one.)
You need to add that user in sudoers file
Follow this to solve your problem:
https://docs.fedoraproject.org/en-US/quick-docs/adding_user_to_sudoers_file/
$ sudo usermod -aG wheel *username*
I can’t do this , I can’t use sudo
if you type su? what you get?
su: Authentication failure
From what you say, you do not have an administrator account any more: you removed your user from the wheel
group when you did usermod -G music
. So this user does not have sudo
access now. Fedora, by default does not activate the root
user either.
We’ll have to recover your administrator account. It should be doable by booting into the single-user mode, but I haven’t done it in a while so I’m looking for a good source to direct you to
Is this issue in Fedora Operation System?
No—you removed your administrator account. Not really anything Fedora (or any other distribution) could do here
What do you think about this ?
So, these steps should work (not been able to test them out yet)
- reboot
- when you see the Grub bootloader, use the arrow keys to navigate to the latest kernel (the one already selected will do fine)
- press
e
to edit it - use the arrow keys to find the line that starts with
linux...
. - at the end of this line, add:
systemd.unit=rescue.target
- press
ctrl + x
to boot with this setting
This should (hopefully) get you to the rescue boot. There,
- you can use
usermod -aG ... wheel
to add your user to thewheel
group. - then use
reboot
to restart, and then your user should be back to an administrator.
Edit: found a reference in the docs: Working with the GRUB 2 Boot Loader :: Fedora Docs
I’d try the Fedora docs first—probably nearer to the configuration and set up of your system.
I have entered in the end of the 'linux… ’ line , and pressed ctrl+x
now when it booted it says.
Ugh—this will be because the root
account does not have a password, and is therefore, considered locked.
If you have a live disk, you will have to use this method to reset the root
password, and then add your user to the administrators group again (wheel
): Working with the GRUB 2 Boot Loader :: Fedora Docs
It seems like it needs a fedora-server live USB. It may be quicker to reinstall at this moment
I’ve broken my system many many times over the years while playing with commands to learn how things work, so it’s completely normal, by the way
okay thanks a lot!!
I guess I have learned some new things by this.
If you are reinstalling, please check the default disk-partitioning in Anaconda (the installer). By default, it creates a separate /home
partition, so that when you reinstall, it can be mounted again and you will not lose your data at all—you can create a new user with the same username as before, and the /home/<user>/
directory will be re-used for them again.
It should not be necessary to use a server live image to fix this. You can do it from a workstation live image as well. From a live image, run:
sudo fdisk -l
and find your root partition (something like /dev/sda1
, /dev/sda2
, /dev/md1
, etc.). Then mount it somewhere:
sudo mkdir /mnt/root_of_my_machine
sudo mount /dev/sda1 /mnt/root_of_my_machine
ls /mnt/root_of_my_machine/etc/passwd
If you get an error from the last ls
command, then you’ve mounted the wrong partition, and can umount /mnt/root_of_my_machine
and try again with a different one.
Then chroot into the system, add yourself to the admin group, and exit the chroot again:
sudo chroot /mnt/root_of_my_machine
usermod -aG ... wheel
exit
You should be able to reboot into your system again and sudo
like before.