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 normally ssh into a remote server, for which I previously set an option that allows me not to type my password every time. Now that I forgot it, is there any way to retrieve it?

share|improve this question
up vote 6 down vote accepted

No. User account passwords on Unix systems are saved with one-way encryption and cannot be retrieved. They can only be reset. You will need to login as root or some other privileged account and reset the password for your user.

share|improve this answer
@Bob: To complete Caleb's answer, you've been using public key authentication, which is based on a different set of credentials, not on your password. Your password can only be retrieved by brute force. Ask the server administrator to let you change it. – Gilles May 7 '11 at 12:05
@Gilles: I thought of suggesting that, but decided there was a good chance that his ssh client was just using a password manager rather than that he actually got public key authentication setup. If your guess is correct and its' his passphrase rather than password that's been forgotten, he would need to make a new key pair. – Caleb May 7 '11 at 12:13
I followed these instructions for passwordless ssh oit.uci.edu/computing/bduc/newuser.html#passwordless – Bob May 7 '11 at 12:21
@Bob: Yes, you're using a public key. I understood your question to mean that you can still access the server with ssh, but can't log in locally because you've forgotten your password. Could you clarify your question, to indicate which of Caleb's or my interpretation is right? – Gilles May 7 '11 at 12:26
@Bob if @Gilles is right and you can still get into the box via ssh and your key but don't know the local password, you have a shot to reset the password yourself without the root admin doing it for you by running sudo passwd USERNAME. If sudo asks your for your password you are out of luck, but if it was configured not to ask, you would be able to reset your password without having to enter the old one first (normally required). – Caleb May 7 '11 at 12:38

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.