
More importantly I was logged into Oracle user desktop at that time and switched to root at command prompt. Although the home directory was deleted for the current logged in user but Linux being Linux did not even bothered to notify me. But when I tried to log into Linux again the day after with Oracle user I was unable to see the desktop and I was told that home directory is missing and you won't be able to use GUI or even normal command prompt. I was presented with a drilled down version of Shell terminal which was less than useful for me. So I went to Google and found after some Googling that I need to perform the below mentioned steps to restore my home directory:
1. Log in using root (Yeah, again) and create the home directory manually in /home folder (You can change the location if you want to).
2. Copy the contents of /etc/skel directory to the newly created home directory.
3. Change the ownership from root to the user for which home directory is being created (In my case oracle).
4. Set the appropriate permissions on directory.
Now you can log off that freak root and can log in using the normal user again. Technically below mentioned commands are required to be executed to recreate the lost home directory of e.g. oracle user after you get logged in using root.
mkdir -p /home/oracle
cp /etc/skel/.* /etc/skel/* /home/oracle
chown -R oracle:oinstall /home/oracle
chmod -R 775 /home/oracle
P.S. If you had your personal data stored in your home directory when you lost it, the data will be lost and you will have to restore it using your backup. The /etc/skel only contains files required to get any new user be able to log in unless it is changes manually by System Admins.
Cross Posted on Tech Blessing.
No comments:
Post a Comment