Skip to content

Switch to zsh on ScienceClusterΒΆ

Although it is not possible to change the default shell for a user on ScienceCluster, you can launch a different shell immediately upon login in such a way that it would appear as if it is the default shell. This article describes how to switch to zsh. However, this approach should also work with other shells as long as they are compatible with bash, i.e. bash init scripts can be sourced without errors.

First, from the ScienceCluster you would need to find the absolute path to the shell's binary that you would like to use.

which zsh

This will return the path similar /usr/bin/zsh. After that, you would need to modify the cluster's entry in your local SSH config file ($HOME/.ssh/config) to include RequestTTY and RemoteCommand parameters as shown in the example below.

Host sciencecluster
   HostName cluster.s3it.uzh.ch
   User xxxxxx
   IdentityFile ~/.ssh/id_ed25519
   RequestTTY yes
   RemoteCommand /usr/bin/zsh

The final step is to add several init scripts to ~/.zshrc on the cluster. This is necessary to ensure that slurm and lmod operate correctly in your shell.

source /etc/profile.d/lmod.sh
source /etc/profile.d/spack.sh
source /etc/profile.d/slurm.sh
source /etc/profile.d/z01_lmodenv.sh