I had created a root account when I installed the Centos 5 into my system.
But now the problem I'm facing is that I accidently deleted the root user account in my system.
Is there a way to recreate the root account in the system now, without reinstalling the OS?
How did you delete the root account? Do you still have an open session for root?
If not, you'll have to boot using the installation media to "Rescue Mode" (or something similar). Mount the root device of the system as read-write.
In both cases, add/modify the line for root in /etc/passwd to read (change the shell if needed).
and this line for /etc/shadow (enter the second field EXTACTLY as shown:
This should reset the password for root to "p4ssw0rd" (without the quotes, that's a zero, not an uppercase O)
I'm attempting to blank out the root user password on a machine that we have forgotten the password for. I have been using the advice posted on this site to boot from CDROM in single user mode, then mounting the root slice and editing the /etc/shadow file. Each time I save the shadow file and reboot the machine, I am still unable to login. After which I go back into single user mode only to find out that the /etc/shadow file is back to its original state and it appears as if I never changed it. Is this being caused by the automounter daemon? If so, how do I turn the automounter off in single user mode?
When you mount the root slice, you need to edit /mnt/etc/shadow or something. /etc/shadow is in memory if you boot from cdrom.
Have a Unix Problem
Return to : - Unix System Administration Hints and Tips
(c) www.gotothings.com All material on this site is