eWebtricity
02-24-2008, 10:51 AM
Here is the procedure to return the password for your root server to the
original:
Boot the server into the Linux Rescue system through the 1&1 Control Panel. Log in via SSH as root. The password should be the default in the Control Panel. Then run the following command from the rescue prompt:
less /etc/shadow
You will see a list of users, password hashes, etc. The root line will look like this:
root:$1$6hX3W97L$U56vyu6vy56v6OAeTY5D7NkJ0:13152:0 :99999:7:::
or similar. This is very important now. Copy everything from the first ":" to the second. In this case, it would be "$1$6hX3W97L$U56vyu6vy56v6OAeTY5D7NkJ0". This is the root password hash.
Copy this to your local machine somewhere safe.
Then, you need to mount the partition /dev/hda1:
mount /dev/hda1 /mnt
Make a copy of your server's shadw file just in case:
cp /mnt/etc/shadow /mnt/etc/shadow_bak
Then use the vi editor to modify the /mnt/etc/shadow file:
vi /mnt/etc/shadow
This will resemble the one you looked at earlier. You will see that there is also a root line here that looks similar again to:
root:y56vu56yc5cw445yy76w7he36g66:13152:0:99999:7: ::
Replace the characters between the first and second colon with the characters you copied from the /etc/shadow file that you had copied to your local machine. Do not modify anything after the second colon.
Save the changes, unmount the partition /dev/hda1 with the command "umount /mnt" and reboot the server into local through the 1&1 Control Panel. You should now be able to login.
original:
Boot the server into the Linux Rescue system through the 1&1 Control Panel. Log in via SSH as root. The password should be the default in the Control Panel. Then run the following command from the rescue prompt:
less /etc/shadow
You will see a list of users, password hashes, etc. The root line will look like this:
root:$1$6hX3W97L$U56vyu6vy56v6OAeTY5D7NkJ0:13152:0 :99999:7:::
or similar. This is very important now. Copy everything from the first ":" to the second. In this case, it would be "$1$6hX3W97L$U56vyu6vy56v6OAeTY5D7NkJ0". This is the root password hash.
Copy this to your local machine somewhere safe.
Then, you need to mount the partition /dev/hda1:
mount /dev/hda1 /mnt
Make a copy of your server's shadw file just in case:
cp /mnt/etc/shadow /mnt/etc/shadow_bak
Then use the vi editor to modify the /mnt/etc/shadow file:
vi /mnt/etc/shadow
This will resemble the one you looked at earlier. You will see that there is also a root line here that looks similar again to:
root:y56vu56yc5cw445yy76w7he36g66:13152:0:99999:7: ::
Replace the characters between the first and second colon with the characters you copied from the /etc/shadow file that you had copied to your local machine. Do not modify anything after the second colon.
Save the changes, unmount the partition /dev/hda1 with the command "umount /mnt" and reboot the server into local through the 1&1 Control Panel. You should now be able to login.