-
-
Save diyism/038bc20d8e5949cf1c1f2c51d5f56ee7 to your computer and use it in GitHub Desktop.
| #go to https://shell.cloud.google.com/ | |
| #in Terminal(bottom half page) or Cloud Shell tab in IDE(top half page): | |
| wget https://pkgs.tailscale.com/stable/tailscale_1.30.2_amd64.tgz | |
| tar zxvf tailscale_1.30.2_amd64.tgz | |
| mkdir tailscale | |
| cp tailscale_1.30.2_amd64/tailscale* tailscale/ | |
| rm -rf tailscale_1.30.2_amd64* | |
| #in fact, google cloud shell using debian 10, we can use apt: | |
| curl -fsSL https://pkgs.tailscale.com/stable/debian/buster.gpg | sudo apt-key add - | |
| curl -fsSL https://pkgs.tailscale.com/stable/debian/buster.list | sudo tee /etc/apt/sources.list.d/tailscale.list | |
| sudo apt-get update | |
| sudo apt-get install tailscale | |
| nano .customize_environment | |
| /bin/ln -s /home/kxb/.customize_environment /etc/rc.local | |
| while true; do nohup /home/kxb/tailscale/tailscaled --state=/home/kxb/tailscale/tailscaled.state --socket=/home/kxb/tailscale/tailscaled.sock --port 41641 > /dev/null 2>&1; sleep 1; done & | |
| #initial, in /home/kxb, exec: tailscale/tailscale -socket tailscale/tailscaled.sock up | |
| /bin/ln -s /home/kxb/wireguard/boringtun /usr/bin/boringtun | |
| /bin/ln -s /home/kxb/wireguard/wg-quick /usr/bin/wg-quick | |
| /bin/ln -s /home/kxb/wireguard/wg /usr/bin/wg | |
| mkdir /etc/wireguard && /bin/ln -s /home/kxb/wireguard/wg1.conf /etc/wireguard/wg1.conf | |
| WG_QUICK_USERSPACE_IMPLEMENTATION=/usr/bin/boringtun /usr/bin/wg-quick up wg1 | |
| /bin/mkdir /root/.ssh | |
| /bin/cp /home/kxb/.ssh/id_rsa /root/.ssh/ | |
| /bin/cp /home/kxb/.ssh/known_hosts /root/.ssh/ | |
| #for /home/kxb/.ssh/authorized_keys to take effect | |
| /usr/sbin/service ssh restart | |
| #because of gshell vps changing fingerprint regularly, so added "-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" | |
| while true; do nohup /usr/bin/ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o ServerAliveInterval=10 -o ServerAliveCountMax=6 -CND 0.0.0.0:8081 [email protected] >/dev/null 2>&1; sleep 1; done & | |
| mkdir .ssh | |
| nano .ssh/authorized_keys #add the client's pubkey into it | |
| #click "restart" in the three-dots menu at top right corner of IDE | |
| tailscale/tailscale -socket tailscale/tailscaled.sock up #copy url to open it in browser to add this vps into your tailscale devices | |
| #now you can login google cloud shell vps from other linux pc with command: ssh kxb@<tailscale ip for this google cloud vps> | |
| #or setup socks5 proxy: while true; do nohup /usr/bin/ssh -o ServerAliveInterval=10 -o ServerAliveCountMax=6 -CND 127.0.0.1:8083 kxb@<tailscale ip fro this google cloud vps> -p 22 > /dev/null 2>&1; sleep 1; done & | |
| =====================for wireguard============================ | |
| #modify /usr/bin/wg-quick, from: | |
| cmd "${WG_QUICK_USERSPACE_IMPLEMENTATION:-wireguard-go}" "$INTERFACE" | |
| #to | |
| cmd "${WG_QUICK_USERSPACE_IMPLEMENTATION:-wireguard-go}" "--disable-drop-privileges" "$INTERFACE" |
@TroyMitchell911 Google cloud shell will keep files in home folder for a long while(maybe over 6 months, if you using it everyday, it will be forever), so after you restart it, you can continue use all apps in home folder. If you have a $4.10/month budget, you can use the hetzner vps 4GB RAM + 20GB SSD, i think it has best cost-effectiveness.
@TroyMitchell911 Google cloud shell will keep files in home folder for a long while(maybe over 6 months, if you using it everyday, it will be forever), so after you restart it, you can continue use all apps in home folder. If you have a $4.10/month budget, you can use the hetzner vps 4GB RAM + 20GB SSD, i think it has best cost-effectiveness.
Of course, I know it will keep files in the home folder. But the session will close in an hour if there's no activity. So the biggest question is, do I have to go to the shell every hour to restart Tailscale? Or if Tailscale has traffic going through it, will the shell stay open, meaning I only need to start it before using it each day?
but it will close in a hour. If it's worth to deploy it?