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 lost/forgot the root password to a server sitting beside me and am trying to reset it. I would rather not have to wipe and re-install or use a Live CD (server is running Ubuntu Server 12.04). What I've tried so far...

1) Boot into "Recovery mode" from Grub2 boot menu then drop into root shell prompt. I am prompted to "Give root password for maintenance". No-go.

2) Change the boot parameters for the main boot option to include "rw" and "init=/bin/bash". When I then boot with Ctrl-X, the screen goes black, and nothing happens (I've waited five minutes). init=/bin/sh and init=/bin/static-sh both do the same thing, while init=/sbin/init boots as normal.

Is there anything else I can try to reset the root password? Thank you!

share|improve this question
1  
If you would have left Ubuntu with the standard configuration, then root would have a disabled password, and you would have gotten a menu you when you went into recovery mode. Did you also forget the password for the first account that had sudo access? –  Zoredache Nov 30 '12 at 17:43
    
Have you considered using sudo that way you would not need to use the root password all the time? –  mdpc Nov 30 '12 at 18:11
add comment

2 Answers

If you're already rebooting, just boot into the Live CD, chroot into the server's root filesystem, and run passwd. Problem solved.

share|improve this answer
add comment

I just tried on a near-blank Ubuntu server 12.04 in Virtualbox. Holding SHIFT down while booting, choosing the first entry, pressin "e" to edit, I replace

ro quiet

with

rw nosplash boot=/bin/bash

and it boots up without problems into a bash-shell. Perhaps the graphic-cards is making you trouble, thus the nosplash.

share|improve this answer
add comment

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.