Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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 have mistakenly setting my user login shell to some unknown directory:([1]. Now, I can't login to this user. Every time I try to ssh, it always failed as if I enter the wrong password. I try to login using root and do su --shell=/bin/tcsh username and I got

su: /path/to/shell/i/set/previously: permission denied

To be clear, /path/to/shell/i/set/previously point to some directory, not to shell executable. I've tried to change my login shell on /etc/passwd back to /bin/tcsh with no luck:(. Always got the same permission denied error:(.

Now, I wonder what chsh did that make me unable to login even after I change the entry on /etc/passwd. Also, how do I get back my previous shell (/bin/tcsh)

Thank you.

share|improve this question
up vote 1 down vote accepted

Login as root and use:

chpass username

You'll be in a vi buffer with the user settings. Change the shell to /bin/tcsh and Bob's your uncle.

As for why, these settings are actually held in /etc/master.passwd. /etc/passwd is generated from that file. Read The Fine Manual for more.

share|improve this answer
Unknown command “chpass” ... and how do you do this if the root user is the one you changed? – endolith Nov 21 '09 at 8:26
@endolith Are you using freebsd? – Richard Hoskins Nov 21 '09 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.