How to reset root password for Command Line

Hi ,

I have forgot my root password for command line , while my web interface is working through admin user.

Please guide to reset my root password.

The underlying operating system is a version of Centos. There are a thousand tutorials out there that tell you how to recover the root password from the console.

Thanks for update, but i’ve already done that all way, but it is not working.

in grub edit, append line with Single ot init=/bin/sh or init=/bin/bash …all tried but it is still not working.

Your OS is ?

FreePBX + Asterisk

That’s not the OS, Debian or RedHat based?

cat /etc/issue

and

uname -a

should resolve if you don’t know.

1 Like

How can he give you that info if he doesn’t know the root password.

Google Linux single user mode booting. You need to intercept the boot where it shows you the scree that has the kernel that is being loaded and spend in the word single to boot to single user mode.

1 Like

hehe, good point, maybe

“how did you install your system?”

or a wild guess append “single” to the kernel arguments for Redhat stuf.

Thanks …pls see attached snap

So you apparently have a root login to your console, no?

no…actually i am able to login through kernel single user mode, I append in command line " init=/bin/bash"

then change root password also, but still it is not working.

I’ve tried with append “Single” , “init=/bin/sh”, and “init=/bin/bash” but nothing is going right.

I’m confused, you can login in single user mode , but you can’t login locally with your changed root password after rebooting, is that right?

You have us so lost. If you are logged in single user mode then type passwd and enter in your new password twice and reboot the box and you should be all set.

yes …exactly…it is the issue, even i have changed the shadow file also but still it is not working

It should be, but it is not happening that is the problem , I have changed the password with passwd command but after rebooting the system it is not working …

Well I’ve never seen that.

Edit out the first asterisk for the root Line in /etc/passed (no password needed for root)

Then in single user mode

init 3

sorry guys …i was out of town for Diwali Vacations…now I am back…

@ Dicko…I’ve tried that one also …edit /etc/passwd for root user, but it is also not working.

Sorry, I can’t help further. It just doesn’t work the way you describe.

Did you try this procedure:

CentOS 6 Root Password Recovery

Did you read this thread fully?