Now days most of the distros are password protected even in singled user mode,hopefully everybody knows that you have press E at the boot promt and with kernel paramaters pass S as an argument and then ENTER and press b... like the screen shot attached below
But you ll be stuck in a place where it ll ask you to enter root password of enter CTRL-D. Attached screen shot below.
what if you don remeber the root password, how do we by pass this. well thats simple. all you have to do is add a parameter that replaces init , during the actual boot up always the init parameter will be /sbin/init which is the first process which spawns all the other process, now what we are going to do it replace this process with bash. that is pass the parameter as init = /bin/bash it ll take you straight to the bash prompt without asking for a password. Now follow the screen shot below
Initially after it takes us to the bash prompt when we do a passwd, the password remains unchanged this is because we have tweaked the normal boot up process so our root file system mounts in read only mode we have to remount it with read write mode; after we remount it with write mode.( if you notice in the grub prompt while writing init = /bin/bash there is a text 'ro' if you replace it with 'rw' then there is no need of remounting it with write permission), if we execute the command we can happily change the password and reboot into normal mode and start linuxing :)
hope this helps.
But you ll be stuck in a place where it ll ask you to enter root password of enter CTRL-D. Attached screen shot below.
what if you don remeber the root password, how do we by pass this. well thats simple. all you have to do is add a parameter that replaces init , during the actual boot up always the init parameter will be /sbin/init which is the first process which spawns all the other process, now what we are going to do it replace this process with bash. that is pass the parameter as init = /bin/bash it ll take you straight to the bash prompt without asking for a password. Now follow the screen shot below
Initially after it takes us to the bash prompt when we do a passwd, the password remains unchanged this is because we have tweaked the normal boot up process so our root file system mounts in read only mode we have to remount it with read write mode; after we remount it with write mode.( if you notice in the grub prompt while writing init = /bin/bash there is a text 'ro' if you replace it with 'rw' then there is no need of remounting it with write permission), if we execute the command we can happily change the password and reboot into normal mode and start linuxing :)
hope this helps.




No comments:
Post a Comment