Lost shell password: change user password from root

2

1

I recently accidentally forgot my user password to my shell. I know the root password. How do I change the user password?

I figure it's something like

$su root
$passwd -[something] username

but I can't get it to work. Halp pls?

Ritwik Bose

Posted 2010-01-10T00:59:45.857

Reputation: 828

Answers

3

just "passwd mechko" I think, if you're logged as root ? tried it ? as existing password use roots or mechko's (in this case roots)

Rook

Posted 2010-01-10T00:59:45.857

Reputation: 21 622

passwd $user as root doesn't require providing the current password. – Blacklight Shining – 2013-10-07T12:49:55.893

Thanks a lot. I was looking at man pages even before I tried changing it so I got confused :-p – Ritwik Bose – 2010-01-10T01:48:11.110

-1

Old school, more powerful than necessary method:as root empty the password field for that user in /etc/passwd or /etc/shadow. Then you can login and change the password.

dmckee --- ex-moderator kitten

Posted 2010-01-10T00:59:45.857

Reputation: 7 311

2no, don't, unless you know how to fix it when you break things. the passwd command exists for a reason. – user23307 – 2010-03-01T02:14:51.603

I'll keep that in mind for next time :D – Ritwik Bose – 2010-01-10T01:49:15.210