On Jan 25, 2008 7:51 AM, Richard Meyer <<a href="mailto:meyerri@westnet.com.au">meyerri@westnet.com.au</a>> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div></div><div class="Wj3C7c">On Fri, 2008-01-25 at 07:23 +0900, Tomasz Grzegurzko wrote:<br>> On Jan 25, 2008 2:34 AM, Bret Busby <<a href="mailto:bret@busby.net">bret@busby.net</a>> wrote:<br>><br>>         Hello.
<br>><br>>         Some time ago, I changed the root password on my laptop, when<br>>         I took the<br>>         computer to a workshop, to get some problems fixed.<br>><br>>         I have since, not been able to remember the root password, and
<br>>         cannot<br>>         log in as root, to do necessary system maintenance.<br>><br>>         So, I cannot do things like FTP across our LAN, as /etc/hosts<br>>         does not<br>>         include most of the nodes, and I cannot update /etc/hosts.
<br>><br>>         Is it possible to somehow access the previous root password<br>>         that I used?<br>>         That one, I remember.<br>><br>>         Or, do I need to rebuild the system; reinstall it all over
<br>>         again?<br>><br>>         If I have to reinstall it all over again, as the computer dual<br>>         boots<br>>         with MS Windows XP, can I reinstall the Linux, only, or would<br>>         I need to
<br>>         reinstall Linux, and then reinstall Windows XP?<br>><br>>         The Linux is Debian stable (etch ?), having upgraded (?) from<br>>         sarge (not<br>>         a clean install of Debian 4.0
, but an upgrade from 3.1 to<br>>         4.0).<br>><br>>         Thanks in anticipation.<br>><br>>         --<br>>         Bret Busby<br>>         Armadale<br>>         West Australia<br>>         ..............
<br>><br>><br>> Hi,<br>><br>> There's more than a couple of ways in. If you have an account which<br>> has sudo access, then you need only to<br>> # sudo passwd<br>><br>> Enter your password, then a new root password twice.
<br>><br>> If you do not have such an account, you need to find yourself some<br>> kind of Linux installatino or live CD. Boot off that. Once you can<br>> drop to a console, find which partition your root filesystem is
<br>> located in, and mount it somewhere. Finally, chroot in to that target<br>> and reset the root password. Here's an example:<br>> # cat /proc/partitions<br>> <to help you locate where your root partition is. Alternatively, edit
<br>> the boot up grub menu and check the root= parameter from the kernel<br>> boot flags.><br>> # mkdir /target<br>> # mount /dev/sda1 /target<br>> # chroot /target /bin/bash<br>> # passwd<br>> <enter the new root password twice>
<br>> # exit<br>> # umount /target<br>><br>> Reboot the computer, boot back in to Linux, and you're done.<br>><br>><br>><br>> Hope that helps.<br>><br>> Tomasz<br><br></div></div>When booting you could try giving it the extra parameter "init=S" (IIRC)
<br>(to start in single user mode) and then enter "passwd" and enter the new<br>password, then "init 5" (or whatever Debian wants) and you should be up<br>in multi-user mode.<br><br>HTH<br></blockquote>
</div><br>Ahh that's a nice way too of course; since you can boot your system okay, you can just append to the kernel boot params:<br>init=/bin/bash<br>you'll get a prompt so you can change the root password. Once you're done,
<br># exec /sbin/init<br><br>(Told you there were more than a few ways ;)<br><br>Tomasz<br>