Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

5 Answers 5

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.

share|improve this answer
    
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.
share|improve this answer
up vote 1 down vote accepted

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.

share|improve this answer

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.

Addendum:

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.

share|improve this answer
    
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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.