Regaing Lost Root Password?
Hi, I have installed Ubuntu 8.04 but lost my root password, how can I find it again?
Either that or I will have to reconfigure. |
Boot from the installation disc (or use any other live-cd Linux distribution), then mount your on-harddisk Ubuntu's root partition, edit there /etc/shadow and empty root user's password field (first field is username, then comes field separator which is :, then comes password field, then field separator :, ...) Save the file and reboot as you usually would - if you did it right, you should now be able to login as root without a password (because it was set blank).
Mounting a partition (assume first primary harddisk partition to be sda1 and mountpoint /mnt): Code:
sudo mount /dev/sda1 /mnt Code:
sudo gedit /mnt/etc/shadow Code:
root:!:13970:0:99999:7::: Code:
root::13970:0:99999:7::: With root account open you can then use passwd to reset other accounts' passwords if you need. |
Alternatively you could use single user mode. I believe a quick google seach on "ubuntu single user mode" should give plenty of hits on that. Once in single user mode you can just type "passwd root" and should then be able to reset root's password. Also you may want to check you don't have sudo access with your normal none root account by typing "sudo su -" and retyping your password (not your root password). If that gets you into root then you can just type passwd that way. Single user mode is usually the easiest way to reset a lost root password if their is no sudo access either.
|
Quote:
It would be good to go to BIOS settings and (in addition to setting up a password for entering the setup utility) set default boot device to be harddisk, disable boot menu so people couldn't switch to CD and set up a password for altering bootloader configuration/entering single-user mode, but as long as the disk is not encrypted, this is all pretty meaningless -- typically harddisks are fairly easy to remove from the machine and plug onto another machine, on which the disk contents are easy to access (bypassing all bootloader and login troubles). |
All times are GMT -5. The time now is 01:41 PM. |