Velvet Star Monitor

Standout celebrity highlights with iconic style.

general

Recover "passwd" file in fedora

Writer Matthew Barrera

I was trying something and execute the below command

sudo mv /etc/passwd /etc/passwd.bak

Now I am getting the below error whenever I am trying to run sudo

sudo: you do not exist in the passwd database

I am not an expert in Linux stuff. Anyone has any idea how can I recover it?

1 Answer

  1. Boot a live Linux that will give you ability to act as root. (Alternatively pass init=/bin/bash in your current bootloader to boot your current Linux to an elevated shell.)

  2. Mount the filesystem holding the troublesome file. Example:

    mount /dev/sdb2 /mnt

    You need to know which device to mount; helpful commands: lsblk, fdisk -l. This step will be more complex if you're using LVM, encryption and/or such.

  3. Rename the file back. Example:

    mv /mnt/etc/passwd.bak /mnt/etc/passwd
  4. Unmount the filesystem, this should sync the change. Example:

    umount /mnt
  5. Reboot; boot the fixed OS normally.

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy