Resetting root password

From BitFolk
Revision as of 19:02, 21 October 2010 by Strugglers (talk | contribs) (Created page with "How to '''reset your root password'''. Let's say you've been a bit silly and misplaced your root password for your VPS, and have no means to log in to it. There's a variety of w...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

How to reset your root password.

Let's say you've been a bit silly and misplaced your root password for your VPS, and have no means to log in to it. There's a variety of ways you can get yourself out of this predicament without having support do it for you.

Via rescue VPS

There's a rescue environment which all customers can boot into. It runs from RAM and gives you access to your block devices. It's easy to reset your password this way, or fix a lot of other things.

Access to the rescue VPS

The rescue VPS is accessed via the Xen Shell. So:

$ ssh username@username.console.bitfolk.com
Password:
xen-shell v1.48bitfolk1 - type 'help' for help.
xen-shell> help

xen-shell v1.48bitfolk1

The following commands are available within this shell:

  boot      Boot your VPS.
  console   Gain access to your VPS via the serial console.
  destroy   Immediately destroy your running VPS - dangerous!
  exit      Exit this shell.
  help      Show general, or command-specific, help information.
  reboot    Reboot your VPS.
  rescue    Boot into the rescue environment.
  shutdown  Shut down your VPS.
  status    Show the status of your VPS.
  uptime    Show the uptime information of the host and guest systems.
  version   Show the version of this shell, and of Xen.
  xfer      Show data transfer stats.

  For command-specific help run "help command".

xen-shell>

Only one VPS instance can be run at once

The rescue VPS can only be booted when your real VPS is not running, so if it is you'll have to shut it down:

xen-shell> shutdown
Shutting down instance: username
Domain username terminated
All domains terminated

Boot rescue VPS

xen-shell> rescue
Booting rescue instance: username
Using config file "/etc/xen/username.rescue.conf".
Started domain username
                     Linux version 2.6.18-6-xen-686 (Debian 2.6.18.dfsg.1-26etch2) (dannf@debian.org) (gcc version 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)) #1 SMP Sat Feb 20 01:44:14 UTC 2010

[...]

Resetting root password to random value:
        New root password: ioYooTei
Creating SSH2 RSA key; this may take some time ...
Creating SSH2 DSA key; this may take some time ...
Restarting OpenBSD Secure Shell server: sshd.
Starting OpenBSD Secure Shell server: sshd.
Running local boot scripts (/etc/rc.local).

BitFolk Rescue Environment

This virtual machine is running read-only over NFS with a unionfs ramdisk to
allow changes.  This means:

- anything you write to its filesystem will not survive a reboot
- you only have about half your RAM size as writable space

If you need to write more, you are going to have to mount your VPS's normal
filesystems to do it on.  Your block devices should available for mounting; see
/proc/partitions.

The root password has been randomly-generated (see above); be careful what you
do with it as networking is now active and sshd is running.

rescue login: