Obtain root shell after booting

From Wiki

Jump to: navigation, search

Most people use a LiveCD or use single-user-mode. Another way is to edit grub and pass a init=/bin/bash option at the end of the kernel config line.

1. At the Grub Menu (for debian, blue square with text entries), select the boot line and press "e" to edit.
2. Go to the kernel line and press "e".
3. At the end of the kernel line (after root=/dev/sda1) put:  init=/bin/bash  (then press enter)
4. (back at the grub menu) Press "b" to boot.
5. You will be dropped into a root shell with /dev/sda1 mounted readonly.  ( root@(none):/# )
6. To mount the filesystem rw, type: mount -o remount,rw /
7. Check with df -h. Type "passwd" to change root password if need be.
Personal tools