User account has no sudo permission

Hello everyone, my friends.

I’m a newer for Rocky Linux, I installed Rocky 9.6 on my PC yesterday.

I created a user account, but I forgot to set my new user account to administrator, and the root user also had been banned, so there is no user account has “sudo” permission in the system

So, how I should to do something to resovle it?

I forgot to check the item “Make this user administrator”, and root user also be banned

so, I have no idea how to use “sudo” when I want to use it.

Hi @Sunny,

if you are able to shutdown this system and access the disk directly from another OS, you can edit the group file to include your user in the wheel group.

“root” is banned or “root” logins are not allowed? Did you create a password for root on install? Assuming you did create a root password then open a terminal and change to the root user thus:

$ su -
<root passwd>
 groupmod -a wheel -U <your username> 

Then type ctrl d to exit the root user and logout and back in again and you should have sudo permission.

I did’t create a password for root. The setting of root user is default when I installed Rocky Linux.

In other words, “root” user has been locked

yes, my noe-privileged user account can shutdown system. I did install the system to VM software, but I don’t know how to access the disk directly from another OS, could you give me some tips?

The easiest way for this would be booting the installation image again and then switching to the shell (alt + f2).
Then you basically just need to mount the root disk.
There it depends on your disk configuration, assuming your system is using EFI, disk is sda and you used the default partitioning it’s most likely partition 3 (sda3) with LVM on it and the root partition then it rl-root. (use ls /dev/mapper, lsblk and blkid to find out if your configuration matches the assumptions before and after scanning for LVM disks)
then it’s just a vgscan and vgchange -ay away from being able to mount /dev/mapper/rl-root, best just mount it to /mnt.
And then you can just do a vi /mnt/etc/group and add your username at the end of the wheel line.

This is the very condensed version of it, if you need it more in detail I might need some outputs of your system (the beforementioned ls, lsblk, …)

The installation image should have “Troubleshoot” option, and within it “Rescue”. Than may automate part of the “find and mount”.


Then the “disk” of the VM would be an “image/file” on the host to access and mount, for example by creating a second Rocky VM and attaching the image to that VM (and then find&mount&edit).

1 Like

The more you know :slight_smile:

Thanks for the answers from friends, I had reinstalled Rocky Linux eventually, because there was no “Troubleshoot“ option when the system booting, I installed Rocky server with GUI the first time, and I don’t know why has no “Troubleshoot“ option when the system booting.

When the Rocky 9 installer boots, does it not show something similar to:

The “Troubleshoot” option appears when you boot from the Rocky installation media (DVD, USB etc).

Thank you very much. I have already known what’s wrong when the system booting when I saw the link you gave me.

I booted Rocky from hard driver, so there was no “Troubleshoot“ option, just like this picture:

I didn’t notice CD/DVD, because I moved the path of CD/DVD. and also remove “CD/DVD“ option in the VM

But now I saw the article you pushed me, I found the answer why “Troubleshoot“ option didn’t appear. See the picture:

I did do it just like the guide of article you pushed me, and setted the boot option from CD/DVD,

now, I find “Troubleshoot“ option.

Thank you very much again!

1 Like

Yes, I have known where my fault is, and thank you for your answer.

Thank you