', 'auto'); // ga('send', 'pageview');

How to Change the Root Password on Another Drive Using a Live Distribution Bootable USB

Warning: If you have RAID configured for your drive, it may shove existing RAID ‘multiple devices’ (md) into a different device name.

Example: ‘md1, md2, md3’ may move over to ‘md127, md128. md129’; when booting back into the drive, you may need to re-mount the partitions if they are set to mount during boot.

Previous sysadmin didn’t leave the root password for the system? Here is a quick guide to resetting the password on systems with a Linux-based OS.

1. On the live disiti, make a directory for mounting the target drive containing the boot partition
root@live:~$ mkdir /home/exx/target

 

2. Locate boot partition of target drive (in this example, it would be ‘/dev/sdb1’)
root@live:~$ fdisk -l
Disk /dev/sda: 32.1 GB, 32094814208 bytes, 62685184 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 label type: dos
Disk identifier: 0x000a0fa4

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *          32    62685183    31342576    c  W95 FAT32 (LBA)


Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes, 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 label type: dos
Disk identifier: 0x0007fbf1

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048     1026047      512000   83  Linux
/dev/sdb2         1026048  1953523711   976248832   8e  Linux LVM

 

3. Mount target drive partition to the directory file you just created
root@live:~$ mount /dev/sdb1 /home/exx/target

 

4. Use ‘chroot’ command to become root user of that file system
root@live:~$ chroot

 

5. Use ‘passwd’ command to change root password
root@live:~$ passwd
Changing password for user root.
New password:

 

6. Exit ‘chroot’ shell
root@live:~$ exit

 

7. Safely unmount the drive from the file system you created
root@live:~$ umount /dev/sdb1 /home/exx/target

 

Be sure to remove the bootable flashdrive to make sure you don’t accidentally boot into the live OS again, and boot back into the drive that you just changed the root password for.