sudo: unable to stat /etc/sudoers: No such file or directory
I moved the file /etc/sudoers to /etc/sudoers.bkp after this I cannot run sudo command and neither can login as root and change the file back is there any way this can be resolved without reinstalling the system
Operating System: Red Hat Enterprise Linux 8.4 (Ootpa)
Please suggest
Solution 1:
You can start the emergency mode and then change the name of the file
Bootup into Emergency mode(target)
-
During bootup, when the GRUB2 menu shows up, press the e key for edit.
-
Add the following parameter at the end of the linux16 line :
systemd.unit=emergency.target
- Press Ctrl+x to boot the system with the parameter.
OR
-
Method 1 There is a GRUB2 menu option when you boot up the system which can be selected to directly boot into rescue mode.
-
Method 2
-
During bootup, when the GRUB2 menu shows up, press the e key for edit.
-
Add the following parameter at the end of the linux16 line:
systemd.unit=rescue.target
- Press Ctrl+x to boot the system with the parameter
Try this and rename the file, if you want to backup never use the command mv
, now your learn in a tough way is better use the command cp
. The mv
command rename a file when we use the same dir
and move the file into a new location if you specify this new location
Good luck pal