Reset the Root Password (Dedicated Server Linux)

For Dedicated Serversacquired after 10/28/2018

In this article, you will learn how to reset the root password of your Dedicated Server (Linux) using the rescue system.

Requirements:
  • You logged in to the Cloud Panel.
  • The server is powered on.
  • You are in the Infrastructure > Server section.
  • You have created an image of the server in question.

To reset the root password of your Dedicated Server Linux:

  • Activate the desired server.

  • Click Actions > Restart.

  • Activate the Rescue System option.

  • Click Yes. The server is booted into the rescue system.

  • Use SSH to establish a network connection to your server. If you are using the Microsoft Windows operating system, you can use Putty to establish an encrypted network connection to your server.

  • To get information about all disks, type the following command:
    rescue:~# fdisk -l

  • Determine the root partition. The name of the root partition of a dedicated server with software raids is md126 or md2. The name of the root partition of a dedicated server with hardware raids contains the name sda2.

  • To mount the root partition, enter the following command(s):
    rescue:~# mount /dev/MEINEROOTPARTITION /mnt Software-Raid:
    rescue:~# mount /dev/md126 /mnt/ Hardware-Raid:
    rescue:~# mount /dev/sda2 /mnt

  • For the next steps it is necessary to mount the partitions for /usr, /home and /var. To display the contents of the fstab file and determine the associated Devices, enter the following command:
    rescue:~# cat /mnt/etc/fstab The contents of the fstab file will be displayed. Example:

  • Mount the partitions for /usr, /home and /var. Example:
    rescue:~# mount /dev/vg00/usr /mnt/usr mount
    /dev/vg00/var /mnt/var mount
    /dev/vg00/home /mnt/home

  • Use the mount command to check that all partitions are mounted: rescue:~# mount /dev/ram0
    on / type ext4 (rw,relatime,block_validity,delalloc,barrier,user_xattr,acl) devtmpfs
    on /dev type devtmpfs (rw,relatime,size=8116868k,nr_inodes=2029217,mode=755) sysfs
    on /sys type sysfs (rw,nosuid,nodev,oexec,relatime) proc
    on /proc type proc (rw,nosuid,nodev,noexec,relatime) tmpfs
    on /dev/shm type tmpfs (rw,nosuid,nodev) devpts
    on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620) tmpfs
    on /run type tmpfs (rw,nosuid,nodev,mode=755) tmpfs
    on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k) tmpfs
    on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,mode=755) cgroup
    on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/lib/systemd/systemd-cgroups-agent,name=systemd) cgroup
    on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset) cgroup
    on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpu,cpuacct) cgroup
    on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio) cgroup
    on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices) cgroup
    on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer) systemd-1
    on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=22,pgrp=1,timeout=300,minproto=5,maxproto=5,direct) debugfs
    on /sys/kernel/debug type debugfs (rw,relatime) mqueue
    on /dev/mqueue type mqueue (rw,relatime) fusectl
    on /sys/fs/fuse/connections type fusectl (rw,relatime) /dev/md126
    on /mnt type ext3 (rw,relatime,data=ordered) /dev/mapper/vg00-usr
    on /mnt/usr type ext4 (rw,relatime,data=ordered) /dev/mapper/vg00-var
    on /mnt/var type ext4 (rw,relatime,data=ordered) /dev/mapper/vg00-home
    on /mnt/home type ext4 (rw,relatime,data=ordered)

  • Put the mounted partitions in a change root environment:
    rescue:~# chroot /mnt

  • To set a new password, enter the following command:
    rescue:~# passwd

  • Enter the new password and repeat it.

  • Open the Cloud Panel.

  • Click Actions > Restart.

  • Activate the Current operating system option.

  • Click Yes.

The server is restarted. You can then log on to the server with the new password.