Set ZSH as Default Login Shell May 17th 2020 Words: 312

There are tons of articles over the Internet persuading you that “bash sucks! Be a pro-sysadmin and embrace zsh!”. However, when I follow the tutorial to replace the bash with zsh, several problem bit me. So I write this post in case someone ran into the similar scenario.


After installation of zsh, the first run will ask you to generate the configuration file.

Now change the default login shell to zsh by chsh -s \which zsh``. This command will prompt for password of the current user. If the user has no password set(eg. remote login use ssh-key), edit /etc/pam.d/chsh and change the following line

# change this
auth required
# to
auth sufficient

Logout and login again and you’ll probably find everything is B R O K E N ☹


If byobu is set as default shell previously, it needs to be re-enabled by simply execute byobu-enable.

Extend reading: How to use ZSH in byobu without change login shell

Source profile

The /etc/profile is not sourced in ZSH, at least in Ubuntu, which leads to problems, for example, application installed with snap missing desktop icon mysteriously.

This is considered a bug and tracked at launchpad

To solve the problem, add emulate sh -c 'source /etc/profile' to /etc/zsh/zprofile

Port the old .bashrc

ZSH uses its own .zshrc, and unfortunately this file is not interchangeable with .bashrc. If you attempt to source it in ZSH, errors probably occur.

Although .bashrc is most likely script generated and i’s okay for ZSH to ignore it, I still recommend walk through .bashrc file and cherry-pick some command to port to .zshrc, otherwise you may run into $PATH problem like yarn global package not work in zsh.

To be continued

If I ever encounter any other problem, I’ll add to this post.