View Full Version : Server Broken
alexillsley
4th April 2007, 00:03
Hello,
My server has just broken, i was changing arround config.lib.php, and somehow it appears to have removed the root user, once i restarted my system i couldnt login on ssh or on the actual server:( I tried running the server in failsafe mode though still doesnt work. None of the services are working now, ispconfig, apache, etc:(
Is there anyway i can get my root access back?
Thanks, please help,
Alex
If you have access to the machine itself, boot into single user mode and fix your root account that way. If not.... UGH!
alexillsley
4th April 2007, 00:23
Ok. i can see /etc passwd i put in the live knoppix cd, what do i put in /etc/passwd to get my root account back ?
First make sure your password is still in shadow.
If so you can add the following to the first line of /etc/passwd on many distributions:
root:x:0:0:root:/root:/bin/bash
alexillsley
4th April 2007, 00:44
I just went to hit save, and it said that the file was read only :( It wont let me change the permmsions on it :(
How do you boot into signle user mode:confused: i tryed going in failsafe and it didnt work
Most systems you type linux 1 at the boot prompt. What distro are you using?
Here's a link for how to get in using lilo or Grub:
http://aplawrence.com/Linux/lostlinuxpassword.html
till
4th April 2007, 10:16
I just went to hit save, and it said that the file was read only It wont let me change the permmsions on it
If you booted in knoppix, you must make sure that the harddisk is mounted in read/write mode. You can do this by right clicking on the harddisk icon on the desktop and select the read/write mode. Also make sure that you use a commandline editor to edit /etc/passwd, I've seen that some gnome and kde editiors say access forbidden to some system files to prevent them from being changed.
alexillsley
4th April 2007, 13:13
Hello,
Please help me, my server is compleatley broken, i have lost all my hard work i dont wont to rebuild it. I had look and it has compleatley destroyed /etc/passwd and /etc/shadow and also /etc/group. There are no users at all accept ISPConfig ones. I tryed adding back some users, from an old back up of a different server howerer when i restarted and got the login screen it still wont let me in. Please is there anything i can do?
Thankyou for all your help,
Alex
Edit:
if it helps, i can get into the command prompt by typing "linux init=/bin/bash" at grub and i can also see my files on the knoppix CD
alexillsley
4th April 2007, 14:15
In my only option to reinstall?
I tried this http://www.cyberciti.biz/tips/recovering-deleted-etcshadow-password-file.html however it would let me remount the disk
falko
4th April 2007, 15:20
Have you tried Knoppix?
Boot Knoppix, mount your hard disk read/write to /mnt (for example), then run
chroot /mnt
Then try passwd root
Or if that doesn't work, take a look at the useradd command.
alexillsley
4th April 2007, 15:31
It wont let me do that :confused:
root@Knoppix:/ramdisk/home/knoppix# chroot /mnt
chroot: cannot run command `/bin/bash': No such file or directory
By the way im on a raid disk so i have to hda2 and hdb2
alexillsley
4th April 2007, 22:20
Thanks anyway to everyone that helped:) , but i have just started rebuilding system so....
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.