First, how to restore the Linux root folder after deletion?
Today with ordinary users into the system to switch root user prompt without root home directory, do not know what the situation caused
$su - rootwarning: cannot change directory to /root-bash-3.2#
Second, online search method:
Root's home directory is deleted, manually establish/root, and then copy the profile from the user template
The first way to restart:
1. Boot Restart Press "E" key after the kernel this line finally added 1, into single-user mode.
2. Create your own home directory for root
Mkdir/root
#进入家目录
Cd/root
Home Catalogue #复制/etc/skel/templates
Cp-r/etc/skel/*/root
3. Then reboot the system to
Reboot
The second method (no restart required):
At this interface directly in-bash
-bash-3.2#mkdir /root-bash-3.2#cp -a /etc/skel/.[!.]* /root/
Mostly,/etc/skel/, copy the files back inside.
Because the production environment is not easy to restart, I am using the second method to build the root home directory, this late whether there is a problem is unclear.
Under Linux mistakenly delete the root folder recovery method