Open WIFI often allow only traffic via http and https ports. This gist contains steps to allow you to ssh to a machine by first creating a VM, switching the ssh port to listen to port 80. So now, you can ssh (port 80) into the VM, in order to ssh (port 22) into your desired machine.
original gist by guillochon, this Fork contains reformatted steps, and I switched OS from CentOs to Ubuntu... just as an exercise to get famaliarized with GCP.
https://gist.github.com/guillochon/eeaa54b328952d260472c14c559f698a
Estimated time to complete the below steps is 5 to 10 minutes (assuming the internet connection is good, and GCP is operating smoothly).
-
goto to GCP console.cloud.google.com
-
in GCP, select an existing project or create a project
ssh-via-https
-
create VM via -
Navigation Menu
(top-left corner) -->Compute Engine
-->VM instance
, then clickCreate
button. -
in
Create an instance
page, configure the below.name (whatever you want): ssh-https-instance Machine configuration: Machine family: General-purpose Generation: First (???) Machine type: f1-micro (1 vCPU, 614 MB memory) Boot disk: OS images: Ubuntu 18.04 LTS Minimal Boot disk type: Standard persistent disk Size: 10GB Identity and API access: just leave as is... (???) Firewall Allow HTTP traffic: CHECK! Allow HTTPS traffic: CHECK!
-
in
Create an instance
page, hitCreate
button. -
in
Compute Engine
,VM instances
page, you should see the created VM being prepared. -
once VM is ready - there will be a green check icon, prepended in front of VM name. The pubic IP is now displayed in the
External IP
column. -
click the
SSH
drop down (columnConnect
), and selectOpen in browser window
. -
in "browser-terminal", try to ssh in to your machine. If you can't ssh into the machine, then you are out of luck... please
GOTO
last step of this gist. -
continue with the below if you want to use your computer's terminal.
-
in
Compute Engine
,VM instances
page, click the VM name and verifyAllow HTTP traffic
andAllow HTTPS traffic
is checked inFirewall
section. -
in your computer terminal, get public key ready.
cat ~/.ssh/id_rsa.pub
-
in the "browser-terminal"
- configure SSH to listen to port 80
sudo echo "Port 80" >> /etc/ssh/sshd_config
- add in your computer's public key to
authorized_keys
.
echo "$MY_COMPUTER_PUBLIC_KEY" >> ~/.ssh/authorized_keys
- restart SSH service
sudo service ssh restart
-
in computer terminal, try to ssh to the Public IP of the newly created GCP VM instance with port 80.
ssh $VM_PUBLIC_IP -p 80
-
fix whatever you need to fix, and remember to reimburse your airplane wifi fee.
-
shutdown/terminate VM.