I have accidentally removed /etc/ folder.
Now there is no way to do any administration, because
/etc/shadow are lost.
Is there any way to restore it in Ubuntu?
Restoring files from ext4 is not really easy :-/
You could start from the Live CD and copy all the files from there into your /etc directory. But I fear that will not work.
A clean install should give you better results in less time, but everything will be lost. Personal data has to be backed up before!
You can get a list of all installed packages with
and you can reinstall packages with
With those two commands one could build one command which reinstalls all installed packages. This could help. However, I do not have the time now, to create this command for you. If someone has time - please just edit this posting.
Restore from backup, or reinstall. If you reinstall, use manual partitioning, and do not check the format box and your personal data should remain intact. More recent releases also have the option to reinstall/replace the existing install, without formatting. This is easier to use than manual partitioning.
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
You can the copy /etc to
You will then need to manually edit
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 ^^
And set your user password
You also need to update
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