How to switch to zsh on ScienceClusterΒΆ
Unfortunately, it is not possible to change the default shell for an account on ScienceCluster. Nevertheless, it is possible to 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, which is installed on ScienceCluster as a module. 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, you would need to find the absolute path to the shell's binary that you would like to use.
module load zsh/5.9
which zsh
This will return a path similar to /apps/opt/spack/linux-ubuntu00.00-x86_64/gcc-00.0.0/zsh-5.9-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/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 hpc
HostName cluster.s3it.uzh.ch
User xxxxxx
IdentityFile ~/.ssh/id_rca
RequestTTY yes
RemoteCommand /apps/opt/spack/linux-ubuntu00.00-x86_64/gcc-00.0.0/zsh-5.9-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/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. It would be also convenient to load the zsh
module, so that you could easily start interactive sessions in zsh.
source /etc/profile.d/lmod.sh
source /etc/profile.d/spack.sh
source /etc/profile.d/slurm.sh
module load zsh