0

We seem to have misplaced the root password for a dedicated server we have (with OVH). I asked them for instructions on how to reset the root password and this is what they said:

  1. Reboot in rescue mode
  2. login via ssh (using info provided in an email)
  3. mount the disk with 'mount /dev/sda1 /mnt/'
  4. execute 'chroot /mnt/'
  5. change the password with 'passwd root'
  6. reboot (in normal mode)

i followed the instructions but when i got to step 3 i get this error

mount: unknown filesystem type 'linux_raid_member'

this is the outcome of fdisk -l

    Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0009307f

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048    20973568    10485760+  fd  Linux raid autodetect
/dev/sda2        20973569  1952468992   965747712   fd  Linux raid autodetect
/dev/sda3      1952468993  1953520064      525536   82  Linux swap / Solaris

Disk /dev/md2: 988.9 GB, 988925591552 bytes
2 heads, 4 sectors/track, 241436912 cylinders, total 1931495296 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/md2 doesn't contain a valid partition table

Disk /dev/md1: 10.7 GB, 10737352704 bytes
2 heads, 4 sectors/track, 2621424 cylinders, total 20971392 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

Disk /dev/md1 doesn't contain a valid partition table

i tried

mount /dev/md1 /mnt

and continued with instructions 4-6 but the password was not reset (it looks like it was only done for the rescue disk)

how can i change the password? (i asked the hosting company but they are taking their sweet time to reply)

thanks

Jon
  • 151
  • 1
  • 1
  • 4
  • Where's your other hard drive? – Michael Hampton Aug 12 '13 at 13:37
  • Not sure i understand what you mean. It is a dedicated server, and i don't have physical access to it. All i can do is remotely reboot it and shh to it. i can run a command in it to see if i can answer your question – Jon Aug 12 '13 at 13:57
  • You have software RAID set up, but only one physical drive. Which means your RAID is always degraded since the other physical drive is missing. This may have something to do with your inability to make changes, and is something that you need to have the host investigate. – Michael Hampton Aug 12 '13 at 13:59

3 Answers3

1

If you have a physical access to the machine or IDRAC (for dell servers) or ILO (for HP servers) access, you can reboot the machine, and when you get to the GRUB menu:

1. Choose the line that is used to load up the correct kernel. 
2. Press 'E' in order to edit the line and then at the end of the line which starts with the word 'kernel' add the word 'single' and press Enter.
3. Hit the key 'B' in order to boot to single user mode.
4. When the system boots, type in the shell `passwd` and set the new password for root.
5. Reboot the server and use the newly set password to log into the machine.
Itai Ganot
  • 10,424
  • 27
  • 88
  • 143
0

Without seeing whats on /dev/md1 this is a little tricky, but since you didnt report any error messages when you tried to chroot, I have to assume that md1 is the correct partition.

You could try editing your /etc/shadow file directly and changing the entry for a NON PRIVILEGED user so that it looks like this

someuser::1:::::

Essentially you are blanking out the second field, which normally holds the encrypted password This should allow you to login as some user without entering a password. After rebooting and loging in, you can then

sudo -i
passwd

To change your root password, and of course add a password to someuser.

GeoSword
  • 1,647
  • 12
  • 16
  • i did so but when i tried to login with the username and no password it couldnt. the entry for the user in the shadow file is someuser::14882:0:99999:7::: – Jon Aug 13 '13 at 14:39
0

What i ended up doing was editing the shadow file and replacing the SALT and Encrypted password with my own (that i grabbed from another server).

Hope this helps someone with a similar problem.

Jon
  • 151
  • 1
  • 1
  • 4