Score:0

sudo: unable to stat /etc/sudoers: No such file or directory

um flag

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

jp flag
Dom
Stop the system, boot on USB key, mount your official system and move the file to the right place. The reboot without key
Score:1
pe flag

You can start the emergency mode and then change the name of the file

Bootup into Emergency mode(target)

  1. During bootup, when the GRUB2 menu shows up, press the e key for edit.

  2. Add the following parameter at the end of the linux16 line :

systemd.unit=emergency.target

  1. Press Ctrl+x to boot the system with the parameter.

OR

  1. Method 1 There is a GRUB2 menu option when you boot up the system which can be selected to directly boot into rescue mode.

  2. Method 2

  3. During bootup, when the GRUB2 menu shows up, press the e key for edit.

  4. Add the following parameter at the end of the linux16 line:

systemd.unit=rescue.target

  1. 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

Sarthak Saxena avatar
um flag
This is done in a Ec2 instance so I am not sure if boot time steps can be done.
digijay avatar
mx flag
Here are [the instructions to do this on an EC2 instance](https://aws.amazon.com/de/blogs/compute/using-ec2-serial-console-to-access-the-grub-menu-and-recover-from-boot-failures/) - good luck!
Score:0
cn flag

The issue caused by mistake
instead of

#includedir /etc/sudoers.d

the last line was modified into

#includedir /etc/sudoers
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.