0

I have set a root password when installing the Kali linux and now I have forgotten it.I even don't remember my user name.I have searched through the internet and I have found a method that includes editing the GRUB menu, which doesn't seem to work with the Kali linux version that I have now.What do I do to reset my root password?

migrated from security.stackexchange.com Dec 5 '15 at 18:02

This question came from our site for information security professionals.

  • Not sure if Kali is different from any other default setup (thus only a comment), but I'd assume mount the partition containing /etc/passwd and change it? – dst Dec 5 '15 at 15:42
  • 1
    Which Kali Linux version you are running? – K.P. Dec 5 '15 at 15:58
8

Assuming you are using Kali Linux 1.0, Press "e" to edit Grub Menu. Find the line starting with "linux". Change the "ro" with "rw" and add "init=/bin/bash" after "quiet". Press F10. You will get "root" console. Type and enter "passwd" to change root password. You should be good.

enter image description here

  • 1
    It worked!Since you have skipped some steps that some new users might skip too and find themselves in trouble, I would like to say all what I have done: First I pressed the key "e" as the Kali Linux boot option was selected.After that I edited where the K.P mentioned in the post and pressed F10 key.Then after hundreds of texts emerging and fading, you start to gain access to something like shell.type passwd root and set your password.Remember that you have to type password twice. – The_Diver Dec 5 '15 at 20:13
  • I have question.Since I have seen many tutorials that included editing the GRUB, almost in all of them it was said that you have to mount your hard drive.I didn't mount my hard drive and everything worked.I wanted to ask, why everything worked even when I didn't mount hard drive? – The_Diver Dec 5 '15 at 20:19
  • It happens when your system is hardened i.e. your Grub Bootloader is locked with a password. In that case, you need to boot it with a rescue CD and mount it read-write and then make necessary modification. – Krishna Pandey Dec 6 '15 at 7:54
1

Well I think there is a way taking it back if your user have sudo prvilage and you find out that username?

well let go through it... first you must find a live OS. you can use Kali in live mode , Ubuntu in live mode or whatever.

mount the hard disk that has Kali or the root of your Kali OS. find /etc/passwd and open it... you might find the username you set inside it. something like this: user:x:1000:1000:USER,,,:/home/user:/bin/bash

that's your username.
Hopefuly you know that username pass else you are screwed. if you have the pass you can login to kali with your own username.
to change root. you must use this command:
sudo su -
prompts your username's password. now you have access to root!!! change your root pass by passwd

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