I have accidentally removed /etc/ folder.
Now there is no way to do any administration, because /etc/passwd
and /etc/shadow
are lost.
Is there any way to restore it in Ubuntu?
data-recoveryrestore
I have accidentally removed /etc/ folder.
Now there is no way to do any administration, because /etc/passwd
and /etc/shadow
are lost.
Is there any way to restore it in Ubuntu?
Best Answer
Here is how I would proceed.
If you want to try to manually recover, boot the ubuntu live CD and update everything
You then mount your ubuntu partition at
/mnt
You can the copy /etc to
/mnt/etc
You will then need to manually edit
/mnt/etc/passwd
and/mnt/etc/group
and/mnt/etc/sudoers
The format should be easy enough to understand from existing entries, but if not ask. Make sure your user is in the admin group.
Add in your user to those files ^^
Then chroot
And set your user password
You also need to update
/mnt/etc/fstab
, define your root partition and swap. You can use the live CD as a template for most of the entries.reboot and hope it works.
If not, boot the live CD and back up your data to a flash driver or alternate partition and re-install.
Best of luck