Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am logged in on a server via sshkey (ssh -i /home/me/.ssh/ssh-key me@server).

I got sudo rights on that server from the admin, but I can't exercise them, since I forgot my actual Unix password (or I was never told it). I am already logged on - can I reset my password via passwd, without knowing my old password?

share|improve this question
Sorry, but I doubt it. Ask the admin to reset it for you and change it. – Kevin Nov 30 '11 at 15:12
Yes, I figured - thanks. – nhoening Nov 30 '11 at 15:37
Gah! I even tried passwd --sysadmin-is-a-new-dad and it still didn't work! – Michael Scheper Dec 18 '14 at 3:56
up vote 4 down vote accepted

I'm afraid you're going to have to ask your sysadmin to supply you with a new password. RSA key authentication is accepted by SSH, but not by the passwd command.

share|improve this answer
Thank you, Shadur. – nhoening Nov 30 '11 at 18:53

password cannot be changed with passwd command unless authentication service is from local files (refer /etc/nsswitch.conf). If your login is network based, admin is for rescue and since sudo is generally used in network'd environments, its better you get it reset as you are solely accountable & responsible for your own account's security.

share|improve this answer
Thank you, Nikhil. – nhoening Nov 30 '11 at 18:53

Absolutely. Presuming, that is, that you have permission to change your own password in the first place.

Are you experiencing difficulty when attempting to make the change?

share|improve this answer
The difficulty is that I'm being asked for the old password and I don't know it. – nhoening Nov 30 '11 at 15:37
@nhoening - Ah yes, well that will be tricky. I had forgotten that you do not have your current password. It may still be possible to leverage sudo if the configuration allows passwordless use of the passwd command, although this is unlikely to be the case. – Tok Nov 30 '11 at 16:49

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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