Git Product home page Git Product logo

colab_ssh's Introduction

Colab SSH

Create SSH tunel to a running colab notebook

PyPI version Downloads build_status codecov license

Prerequisite

  • This package only allow SSH public key authentication so you will need to prepare once. You might already had one at ~/.ssh/id_rsa.pub. Refer this to create a new one if you don't had once already
  • In order to connect to the SSH tunel from your machine, you will need to install cloudflared from here

Usage

Create a new Colab notebook with a single cell with the following content:

!pip3 install linus-colab-ssh

from colab_ssh import setup_ssh, loop_forever

public_key = '<YOUR_PUBLIC_SSH_KEY>'
setup_ssh(public_key)
loop_forever()

You can use list of public key or link to a raw text file of authorized_keys like this as well

Optinally, you can also specify a Mattermost Webhook URL with mattermost_webhook_address when calling setup_ssh to send a push notification to your Mattermost channel when the SSH tunel is ready.

Run it, after about 2 minutes, you will see something like this:

Command to connect to the ssh server:
✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️
ssh -o UserKnownHostsFile=/dev/null -o VisualHostKey=yes -oProxyCommand="cloudflared access ssh --hostname %h" [email protected]
✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️
Or you can use the following configuration in your .ssh/config file:
✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️
Host colab
	HostName economic-singapore-place-obtaining.trycloudflare.com
	User root
	UserKnownHostsFile /dev/null
	VisualHostKey yes
	StrictHostKeyChecking no
	ProxyCommand cloudflared access ssh --hostname %h
✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️```

Then voila ;)

Please noted that you must keep the kernel webpage connected to avoid Colab disconnect your kernel early.

Disclaimer

This repo contains many of the configuration that I use for my day to day work so it might not be the best for you.

If you had any problems using this, feel free to open an issue. Otherwise, I highly recommend you to fork this repo and did some necessary modification for yourself. Thanks for checking by

colab_ssh's People

Contributors

lamhoangtung avatar phanthanhtrung avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.