Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Recovering root password should not be too difficult.
At grub prompt press "e" to edit the options and at the end of kernel line add 1 and press enter.
Highlighting this edited line, press "b" to boot with new parameters.
You will be put on a shell with root privileges.
Use passwd root to change the root password.
boot your machine in single user mode.. in /etc/passwd file against your root entry you may find an an x..delete that x and reboot again.. i think that helps.try it at your own risk(also dont try it on machine that you are not supposed to do).
i tried
ssh-3.1# passwd
command in init level 1.....but it is not working
did you actually boot to runlevel 1?? if not, this is what you need to do.
whilst booting, at the grub window, press the e key. select the image you would like to boot then press the e key again. move the cursor to the end of the line, append a space then the number 1.
then press b.
this will boot to single mode. then run the passwd command.
this normally always works.
the fact that you reach this stage
Code:
ssh-3.1# passwd
and you say it doesnt work seems a bit odd as it looks like you are actually the root user at this point. any errors to report?
There is another way...
Start a livecd linux... open /etc/shadow from livecd system, copy the encrypted password from root(or the whole line), and pasted in /etc/shadow from your rhe system...
I think it will work.
Take an livecd that tell's you the root password, or change it with passwd, and then do the copy...
good luck
There is another way...
Start a livecd linux... open /etc/shadow from livecd system, copy the encrypted password from root(or the whole line), and pasted in /etc/shadow from your rhe system...
I think it will work.
Take an livecd that tell's you the root password, or change it with passwd, and then do the copy...
good luck
He means to copy the known password directly. Some live cds will ask you to provide password for logging in.
This passowrd will be stored in the passwd and shadow files on the cd.
He wants entry from the known file to be copied to other.
But changing the password from rescue mode is easier.
I have not tried the above, but I have done similar to it. Boot from a Live CD. Mount the `/` partition of the existing OS. Open the `/etc/passwd` file on the mounted file system. Delete the password field from the root user, eg:
root:x:0:0:root:/root:/bin/bash
Delete `x` from the above. Save the file and reboot it. You are at the login prompt. Just give the root user and password (hit enter). You will be logged in as root. Just open the `/etc/passwd` file and put back the `x` there. You can use `passwd` to change the password.
@ prasanta how does your suggestion differ from my post #3 except that you are using a live cd instaed of being in single user mode..also you didnt mention anything about /etc/shadow. i have doubts with /etc/shadow file.
then two users having same password should have same entry in the shadow file.. am i getting it right.. can that happen?i dont think so..
Exactly. even the same passwords are represented differently in shadow file. I just created a test user and assigned same password as mine and the shadow entry was different.
if they were same then a root user can easily guess the users password if it is same as that of root(a big security flaw)..in linux we cant recover a password but change it(reason md5 hashing).. it is a good security option out there in linux.. i was sure about that because i have already studied it in Security In Computing..i think i made my point clear.
hmm...........finally my password is resetted.........
thanks to linuxlover.chaitnya,strycnine,centosboy,mobinskariya,prasanta
for ur good response........
Nice to hear that. You could tell how you did that so that other newbies coming here for same issue could get help out of this.
Also if you think that your issue is solved, mark the thread as solved from thread tools.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.