I just installed Debian 5 however the install didn't ask me for a root password.

At any rate I can't log in because I don't know the root password.

Is there any way to regain access or do I have to install again?


You don't need a live CD.

  • Reboot, go interactive at the boot prompt (grub).
  • append "init=/bin/sh"

This will replace "init" with a shell, you'll fall straight into a shell, however root will be read-only.

  • mount -o remount,rw / will fix that.

Change your password (mount /usr if you need to), umount everything, reboot.

  • You don't need it assuming the grub/lilo wasn't secured with a password. – Zoredache Jul 14 '09 at 18:53

To reset the password

  • Boot off a livecd
  • Mount the root filesystem
  • chroot into the filesystem
  • and then run passwd root.

First of all, thanks to those who replied. I believe your responses are valid and worthy of upvote, however, I did not try them (and I can't vote as of yet).

What I did was:

  • boot from the 'small' install cd (i.e. the cd I installed from).
  • enter 'rescue mode' going through the prompts
  • mount the partition (from within the 'rescue mode')
  • run passwd root (from the 'rescue mode' prompt)

Similar to what Zoredache and Xerxes explained. There's probably many ways to go about it.

The last time I messed around with Linux was the .99 - 1.3 kernels.


I don't know the latest Debian 5, but if it didn't ask you for a root password, is it possible you just need to login using your normal user (say roygbiv) and run something like that to enable the root login:

sudo passwd root

The first password you'll be asked is your user password (roygbiv) and the next passwords will be your new root password.

You need to do that in Ubuntu (which is Debian based) if you want to activate the root user so I guess it's a possibility. I'm just surprised you weren't asked for the password during the installation process.


I should add that's it's often recommended not to enable root login when you have an installation without default root access. Just use sudo with your own password when you want to do administrative tasks. See https://help.ubuntu.com/community/RootSudo.

  • I think only the 'expert' install will ask for a root password. – staticsan Jun 1 '09 at 5:24
  • Oh, interesting. And does that mean you have root disabled with sudo installed or that you have a default password set up? – lpfavreau Jun 1 '09 at 11:54

Hey, Try to login root using user password.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy