Operating System: Ubuntu 18.04.2 LTS (Server)

Kernel: Linux 4.15.0-54-generic

Architecture: x86-64

When I SSH into my box it uses the MOTD, PS2 and shell from my local profile of the server and what I'm looking for is a way that when I logon locally it's zsh and over ssh it's bash. I've looked in /etc/ssh/sshd_config for something about a prompt/shell but I'm not sure after that. Which other files would I put that distinction in?

1 Answer 1


OpenSSH always uses the shell of the user it is logging in. The simplest way is to change your remote user shell to zsh:

usermod --shell /usr/bin/zsh YOUR_USERNAME

Other possibility is to use ForceCommand in sshd_config, which will run the zsh for you under the default shell (bash). But note, that this will actually prevent you from running any other commands directly, such as scp or sftp!

  • Here is example of ForceComand usage: askubuntu.com/a/1070294/566421. It could be combined with Match User directive: https://askubuntu.com/a/905799/566421.
    – pa4080
    Commented Jul 12, 2019 at 4:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .