How to change default shell in a GCE VM instance?

using os login user instead of default user

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)
chsh: PAM: Authentication failure

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

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

Don't need to create a password, just use sudo # for current logged user sudo chsh -s /bin/zsh "$USER" # or sudo chsh -s /bin/zsh paymahn. If you wish to move a VM from one zone to another, you can take a snapshot of the persistent disks, launch a new instance in the desired zone using the snapshot and cleanup the resources used by the original VM.

Ok, figured it out, kinda. I don't think I had a password set at all. I ran sudo passwd paymahn to create a password and then used the newly created password during the prompt for chsh.

When you use the Cloud Console to create regional or zonal resources like addresses and instances, Compute Engine sets the region and zone fields for you. For example, you must specify a region when you create a static external IP address, and you must specify a zone when you create a Virtual Machine (VM) instance. When you create a project, Compute Engine automatically selects a default region and zone based on the location from which you create the project.

In GCP VM's they don't come with a password by default so you'll first need to change the password using sudo passwd then you can use the root password for your zsh shell.

This error does not affect your instances. If a username is not set by a G Suite administrator, OS Login generates a default Linux username by combining the  I have a couple of Google Compute Engine (GCE) virtual machines spread across two GCE networks. Now I want to move them all to one shared network but I can't find a way to change the network of an existing VM.

Google Compute Engine lets you create and run virtual machines on Google Follow along this lab to learn about how to create virtual machine instances of  To keep the IP address from changing, promote it to a static external IP address. To change the machine type of a stopped instance, use the Google Cloud Console , the setMachineType method in the API, or the instances set-machine-type command in gcloud . You can only change the machine type of a stopped instance and an instance is considered stopped only when the instance is in the TERMINATED state.

The default ssh authentication for GCE instance is public key But when I open shell online and try $su <user name : one of the names from need rootuser password to login unless you change default user name into "root",. To copy a file from your VM Instance to Cloud Storage, SSH your VM Instance and navigate to the directory where the file is and execute the following command. gsutil cp filename gs:// bucket_name This command syncs the file from your Instance to your Storage Bucket.

Manages a VM instance resource within GCE. resource "​google_compute_instance" "default" { name = "test" machine_type = "n1-​standard-1" zone = "us-central1-a" tags Changing this forces a new resource to be created. Most linux-based images will run the content of metadata.startup-​script in a shell on every boot. To connect to a VM instance by using IAP Desktop, do the following: In IAP Desktop, select File > Add Google Cloud project. Enter the ID or name of your project and click OK. In the Project Explorer window, right-click the VM instance you want to connect to and select Connect. For more information on IAP Desktop, see the GitHub project page.

  • When I execute passwd I receive the following error: passwd: Authentication token manipulation error