Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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
like image 815
Paymahn Moghadasian Avatar asked Jan 02 '23 17:01

Paymahn Moghadasian


1 Answers

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

# for current logged user
sudo chsh -s /bin/zsh "$USER"
like image 162
Feng Avatar answered Jan 07 '23 19:01

Feng