Search code examples
shellgoogle-cloud-platformgoogle-compute-enginezsh

How to change default shell in a GCE VM instance?


I've successfully created and logged into a GCE VM with ssh -i ~/.ssh/google_compute_engine <EXTERNAL IP>.

The VM is running ubuntu 18.04 LTS. I've installed zsh. I've verified that the output of which zsh appears in /etc/shells.

When I try to run chsh -s $(which zsh) I'm prompted for a password and I have no idea what to enter.

When I created ~/.ssh/google_compute_engine (which was created during a gcloud ssh command issued earlier) I didn't enter a passphrase for the ssh key.

How can I change my shell?

EDIT: Here's what I see when I've logged in:

paymahn@paymahn:~$ chsh -s $(which zsh)
Password:
chsh: PAM: Authentication failure

Solution

  • Don't need to create a password, just use sudo

    # for current logged user
    sudo chsh -s /bin/zsh "$USER"