Open In App

How to Access Google Cloud Shell via Termux and SSH?

Last Updated : 13 Jun, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

In this article we are going to learn about how to install Gcloud CLI on termux and SSH into your free google cloud console from your mobile.

Installation:

Follow the below steps to SSH into google cloud shell from mobile using termux:

Step 1: You need to install termux on your mobile. Don’t download it from playstore or appstore , instead install F-Droid and install termux from it. Go to the above link and find the latest version of termux and download.

Download termux

Step 2: Now let’s see how to install gcloud CLI , which allows us to SSH into our cloud shell.

  • The first command is:
apt update && apt upgrade 
  • After that enter this command:
pkg install curl
  • Next, enter this command and hit enter:
curl https://sdk.cloud.google.com | bash 

  Here hit “enter” if you are asked for (y/N) after this command.

  • Next, enter this command:
~/google-cloud-sdk/install.sh --override-components 

Note sometimes you will get a screen before entering the above command, so the curl command is enough for installation.

  • Now  hit enter whenever you are promoted to enter (y/N)

Step 3: After all files are installed enter this command:

gcloud components install gsutil 

Hit enter if you are promoted for (y/N) if the prompt shows repeatedly type ‘y’ and hit enter.

 Note: Don’t worry if you get any errors at this stage.

Step 4: Next enter this command to link your Google account with gcloud:

gcloud init --console-only

Note: paste the verification code and hit enter.

  • After this command you will be given a big url , copy it and paste it in the browser and select an account you want , you can see the verification code on the next page copy it, and paste it into the termux.

Note: If you want to change accounts after doing this step, just run this same command (gcloud init) again but this time you will be asked to enter between 2 choices, either re-initialize old configuration or create a new configuration, type 2 and hit enter.

Step 5: And finally use the below command to run the shell:

gcloud alpha cloud-shell ssh

That’s it! Within a few seconds, you will be logged into your free Linux machine.


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads