How to delete and add new password in linux (How to recovey the linux password)

You basically have to gain access to your machine somehow to alter the respective files. A pretty convenient way is to use the bootable installation CDs of some Linux distro and launch some "recovery console". If you can't see some comand like that you might try the ALT+F1..Fx keystroke to maybe get a clear console. 

Once you have managed to get into a shell you need to mount the partition that holds your /etc directory. To reset the root password open the file /etc/passwd and look for a line starting with ... 

root:x:......... 

Delete the "x" in this line as it tells that the password is shadowed. Save the file. 

Secondly open /etc/shadow and search for the entry for the user "root". This one usually looks like this ... 

root:$s0m3fR1g9InMD5h45H:<numbers>:<more numbers>:::: 

Delete all values (the stuff between the columns) so that you get a line like this ... 

root:::::::: 

Save the file, unmount the partitions and reboot. The root-account should not have set a password now, which you should change immediately again. 

hope that helps

Comments

Popular Posts