{"id":13994034,"url":"https://github.com/lamhoangtung/colab_ssh","last_synced_at":"2025-07-22T18:32:59.488Z","repository":{"id":38473318,"uuid":"317110770","full_name":"lamhoangtung/colab_ssh","owner":"lamhoangtung","description":"Create SSH tunel to a running colab notebook","archived":false,"fork":false,"pushed_at":"2021-10-12T03:58:20.000Z","size":136,"stargazers_count":67,"open_issues_count":1,"forks_count":16,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-22T04:41:10.868Z","etag":null,"topics":["colab","ssh"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/linus-colab-ssh/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lamhoangtung.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-11-30T04:29:04.000Z","updated_at":"2025-01-09T23:21:37.000Z","dependencies_parsed_at":"2022-08-19T21:04:33.092Z","dependency_job_id":null,"html_url":"https://github.com/lamhoangtung/colab_ssh","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/lamhoangtung/colab_ssh","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lamhoangtung%2Fcolab_ssh","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lamhoangtung%2Fcolab_ssh/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lamhoangtung%2Fcolab_ssh/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lamhoangtung%2Fcolab_ssh/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lamhoangtung","download_url":"https://codeload.github.com/lamhoangtung/colab_ssh/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lamhoangtung%2Fcolab_ssh/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266552517,"owners_count":23947174,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-22T02:00:09.085Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["colab","ssh"],"created_at":"2024-08-09T14:02:40.581Z","updated_at":"2025-07-22T18:32:54.470Z","avatar_url":"https://github.com/lamhoangtung.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# Colab SSH\n\nCreate SSH tunel to a running colab notebook\n\n[![PyPI version](https://badge.fury.io/py/linus-colab-ssh.svg)](https://badge.fury.io/py/linus-colab-ssh)\n[![Downloads](https://pepy.tech/badge/linus-colab-ssh)](https://pepy.tech/project/linus-colab-ssh)\n![build_status](https://github.com/lamhoangtung/colab_ssh/workflows/Colab%20SSH/badge.svg)\n[![codecov](https://codecov.io/gh/lamhoangtung/colab_ssh/branch/master/graph/badge.svg)](https://codecov.io/gh/Techainer/mlchain-python)\n[![license](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/lamhoangtung/colab_ssh/blob/master/LICENSE)\n\n## Prerequisite\n- 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](https://www.digitalocean.com/community/tutorials/how-to-configure-ssh-key-based-authentication-on-a-linux-server) to create a new one if you don't had once already\n- In order to connect to the SSH tunel from your machine, you will need to install `cloudflared` from [here](https://developers.cloudflare.com/argo-tunnel/downloads)\n\n\n## Usage\n\nCreate a new Colab notebook with a single cell with the following content:\n```python\n!pip3 install linus-colab-ssh\n\nfrom colab_ssh import setup_ssh, loop_forever\n\npublic_key = '\u003cYOUR_PUBLIC_SSH_KEY\u003e'\nsetup_ssh(public_key)\nloop_forever()\n```\n\nYou can use list of public key or link to a raw text file of `authorized_keys` like [this](https://gist.githubusercontent.com/lamhoangtung/4fca574da11ef45869bdfea8062417b5/raw/320893c60a5a150f61481899201664761136fae7/authorized_keys) as well\n\nOptinally, 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.\n\nRun it, after about 2 minutes, you will see something like this:\n\n```bash\nCommand to connect to the ssh server:\n✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️\nssh -o UserKnownHostsFile=/dev/null -o VisualHostKey=yes -oProxyCommand=\"cloudflared access ssh --hostname %h\" root@economic-singapore-place-obtaining.trycloudflare.com\n✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️\nOr you can use the following configuration in your .ssh/config file:\n✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️\nHost colab\n\tHostName economic-singapore-place-obtaining.trycloudflare.com\n\tUser root\n\tUserKnownHostsFile /dev/null\n\tVisualHostKey yes\n\tStrictHostKeyChecking no\n\tProxyCommand cloudflared access ssh --hostname %h\n✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️✂️```\n```\n\nThen voila ;)\n\nPlease noted that you must keep the kernel webpage connected to avoid Colab disconnect your kernel early.\n\n## Disclaimer\n\nThis repo contains many of the configuration that I use for my day to day work so it might not be the best for you.\n\nIf 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\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flamhoangtung%2Fcolab_ssh","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flamhoangtung%2Fcolab_ssh","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flamhoangtung%2Fcolab_ssh/lists"}