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.

1 Answer 1


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.

  • Unknown command “chpass” ... and how do you do this if the root user is the one you changed?
    – endolith
    Nov 21, 2009 at 8:26
  • @endolith Are you using freebsd? Nov 21, 2009 at 12:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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