1. Home
  2. Connecting to your Server
  3. Resetting the Root Password for a Cloud Server

Resetting the Root Password for a Cloud Server

You can reset the root password for a Cloud Server by booting into the ‘rescue’ environment. This will require a short period of downtime.

Restarting Your Cloud Server in the Rescue Environment

When you are ready to reboot your server;

  1. Log in to the Bytemark Panel.
  2. Select ‘Servers‘ from the menu.
  3. Select the server you want to reset the password for. This will expand the server, displaying additional actions & information.
  4. Click the ‘Restart‘ button.
  5. Tick the ‘Start in rescue environment (if your server is broken)‘ box.
  6. Click the ‘Restart server in rescue environment‘ button and your server will reboot.
  7. When the ‘Starting server into rescue environment … please wait‘ message disappears, click the ‘Got it, open the console‘ button to open the console window.

Now you have started your server in the rescue environment, please follow the relevant section below for the operating system your server is running.

Process for servers running Linux

Mounting your drive

At the / # prompt, run the following commands to mount your drive:

mkdir /target/
mount /dev/vda2 /target/

Accessing your file system

To run programs on your real file system you will need to run the command:

chroot /target/

This gives you a prompt ‘inside’ your normal system.

Changing Your Root Password

You can now reset your password by running:

passwd root

You will be prompted to enter the new root password you want to use. It is normal for nothing to be displayed on the screen as you type your password. You will be asked to enter your password for a second time to confirm you typed it correctly. You should receive the message ‘passwd: password updated successfully‘ when this is complete.

Now run the following commands to unmount your drive and reboot your server:

exit
umount /target/
reboot

Process for servers running Windows

  1. Restart your server in the rescue environment.
  2. Add support for the NTFS file system by running the following command:
    apk add ntfs-3g
    
  3. Create a directory called ‘target‘, mount your drive there and navigate to the ‘System32‘ directory.
    mkdir target
    mount -t ntfs-3g /dev/vda2 /target
    cd /target/Windows/System32
    

    Note: If the mount command fails, try running it with -o force on the end

  4. Temporarily replace the ‘Magnify.exe‘ executable so it opens a command prompt instead:
    mv Magnify.exe Magnify.bak
    cp cmd.exe Magnify.exe
  5. Unmount your filesystem and reboot the server by running the following commands:
    cd /
    umount target
    exit
    reboot
  6. When the Windows login screen appears, click the ‘Ease of access‘ icon (bottom left) and click ‘Magnifier‘ which should now open a command prompt.
  7. Reset your password by running the following command, replacing password with the new password you want to use:
    net user administrator password
  8. Login to check the new password works.
  9. Once you have confirmed you can login successfully, restart your server in rescue mode again, and reverse step 4 by renaming the ‘Magnify.exe‘ executable by running:
    mv Magnify.bak Magnify.exe
  10. You’re done! Reboot your server.
Updated on June 25, 2019

Was this article helpful?

Related Articles

Have you tried Kubernetes?
Kubernetes (K8s) is helping enterprises to ship faster & scale their business. Sounds good? Let us build a K8s solution for your needs.
Register your interest