Friday, January 13, 2017

Change root's Password on Rackspace's Rescue Mode

Login onto the Rackspace webfront.
Go to:
Cloud Servers > select server > Actions > Enter Rescue Mode
Save (like Gold) the dinamically generated password!
Login via SSH using root user: ssh -l root pub.ip.address.of.server
There will be an SSH warning, edit the ~/.ssh/known_hosts file.

Once you are logged in onto the server issue a

fdisk -l

Example:

Disk /dev/xvdb: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders, total 41943040 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: 0x00021ebb

    Device Boot      Start         End      Blocks   Id  System
/dev/xvdb1   *        2048    41940991    20969472   83  Linux

Disk /dev/xvda: 21.5 GB, 21474836480 bytes
255 heads, 63 sectors/track, 2610 cylinders, total 41943040 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: 0x00021ebb

    Device Boot      Start         End      Blocks   Id  System
/dev/xvda1   *        2048    41940991    20969472   83  Linux

Disk /dev/xvdd: 67 MB, 67108864 bytes
255 heads, 63 sectors/track, 8 cylinders, total 131072 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/xvdd doesn't contain a valid partition table

Mount the drive:

mount /dev/xvdb1 /mnt/

Check if this is the correct drive on which you have to actually make the password change: less /mnt/etc/shadow
It has to have the users that already have an account on the server.
This took me a while, all the docs, links and references from even the same Rackspace point you to use the /dev/xvda1 but on my case, I had to use /dev/xvb1, YMMV.

chroot /mnt/

Change root's password: passwd
Exit the SSH session
On the Rackspace page, click on "Exit Rescue Mode".
Login via SSH using the regular user once again.
There will be an SSH warning, edit the ~/.ssh/known_hosts file.
Issue a: su - to become root, use the password you just set and so whatever you have to do being root.

Labels: , ,

0 Comments:

Post a Comment

<< Home