Server Fault is a question and answer site for system and network administrators. 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

How do I set the shell that is used when a user SSHs to a server. For example I can't stand BASH and need to use ZSH, how do I make it so ZSH is loaded along with my profile (.zsh_profile) when I ssh to the machine.

I dont want to have to pass a bunch of parameters with ssh either, can't I set the default shell?

share|improve this question

migrated from Jan 27 '10 at 8:36

This question came from our site for professional and enthusiast programmers.

up vote 17 down vote accepted

Assuming you're running on Linux, you can use the chsh command.

chsh -s /bin/ksh foo
chsh -s /bin/bash username
share|improve this answer
Please note that the path to the binary has to be in /etc/shells for the shell to be selectable. – Kimvais Jan 27 '10 at 6:40

man chsh changes shell, does not always work

Alternatively, you can stick exec /bin/zsh in your bash login script.this will replace bash instance with your shell.

Or you can do ssh host "zsh -l"

share|improve this answer
Why the -1 (15 chars...)? – Noufal Ibrahim Jan 27 '10 at 7:31
that is a lower case L – hangtwenty Jan 6 '15 at 21:40

Edit /etc/passwd (if you have the rights, or ask your system admin) to change your default shell.

share|improve this answer
For some reason the users I recently created had no default shell. This worked for me. Thanks. – mimoralea Jul 17 '14 at 20:04

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.