GithubHelp home page GithubHelp logo

wassimbenzarti / colab-ssh Goto Github PK

View Code? Open in Web Editor NEW
942.0 942.0 122.0 386 KB

Connect to Google Colab using SSH

Home Page: https://pypi.org/project/colab-ssh/

License: MIT License

Dockerfile 6.13% Shell 0.40% Python 84.20% HTML 9.11% Makefile 0.16%
google-colab ssh ssh-server ssh-tunnel vscode vscode-remote

colab-ssh's Introduction

Hey ๐Ÿ‘‹, I'm Wassim Benzarti

A 27 year old developer passionate about Computer Science, Infrastructure and UI/UX


trophy

colab-ssh's People

Contributors

agj60 avatar cbdonohue avatar mxaviersmp avatar wassimbenzarti avatar ztgasdf avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

colab-ssh's Issues

init_git_cloudflared asking for github username and password

Describe the bug
Last night I was able to use colab-ssh locally, but now init_git_cloudflared is asking me for my GitHub username and password. This makes it impossible to connect with init_git_cloudflared because we can't connect to GitHub via username and password anymore (we need to use the personal access token, which is what I've been using).

So, even if you put in your username and password, you will get an error saying you need to use a personal access token.

I'm not sure if this is a cloudflare issue or something else entirely. The exact same code was working last night.

To Reproduce
Steps to reproduce the behavior:
launch_ssh_cloudflared(password)
init_git_cloudflared(git_repo + ".git",
personal_token=os.getenv('GITHUB_ACCESS_TOKEN'),
branch="main",
email="email",
username="username"

Expected behavior
It should give me an output message like "successfully cloned git repo to ./."

Screenshots
Screen Shot 2021-09-27 at 3 08 46 PM

New environment variable TF2_BEHAVIOR

This environment variable is required for TPUs to work through ssh. It was added today and it took me a while to figure out why my TPU models suddenly stopped working. :)

In launch_ssh_cloudflared.py I see that you have a "whitelist" with variables to export. May I suggest a "blacklist" approach instead, so that you export all environment variables found except for a list of ephemereal ones? I think that would be more future proof. The blacklisted ones would be LS_COLORS, SSH_CONNECTION, LESSCLOSE, USER, PWD, HOME, SSH_CLIENT, SSH_TTY, MAIL, TERM, SHELL, SHLVL, LOGNAME, PATH, LESSOPEN, and _ (underscore).

kex_exchange_identification: Connection closed by remote host

I tried to connect to google colab via ssh using openssh
While it does runs properly intially and prints hostname , user and port at the end

But while connecting colab via ssh using the printed info , the connection is always failing . It returns the following error -

kex_exchange_identification: Connection closed by remote host
Connection closed by XX.XX.XX.XX port XXXXX

A quick google search about this issue lists this at the top if anyone wants to have a look - https://unix.stackexchange.com/questions/128894/ssh-exchange-identification-connection-closed-by-remote-host-not-using-hosts-d

I also got it tested from one another colab-ssh user and he too confirmed this issue exists at the moment .i would also like to add that it is very unlikely that there's something wrong in my device/openssh . Because i am able to connect to my vps instances using the same device very well . This issue is only occuring with google colab

I am not sure if Google Colab has done something from their end to block ssh connections or its something else

Not connecting to remote server

[19:58:09.144] Log Level: 2
[19:58:09.146] [email protected]
[19:58:09.146] linux x64
[19:58:09.148] SSH Resolver called for "ssh-remote+google_colab_ssh", attempt 1
[19:58:09.148] SSH Resolver called for host: google_colab_ssh
[19:58:09.148] Setting up SSH remote "google_colab_ssh"
[19:58:09.151] Acquiring local install lock: /tmp/vscode-remote-ssh-google_colab_ssh-install.lock
[19:58:09.157] Looking for existing server data file at /home/thunderclap/.config/Code/User/globalStorage/ms-vscode-remote.remote-ssh/vscode-ssh-host-google_colab_ssh-ff915844119ce9485abfe8aa9076ec76b5300ddd-0.51.0/data.json
[19:58:09.159] Using commit id "ff915844119ce9485abfe8aa9076ec76b5300ddd" and quality "stable" for server
[19:58:09.161] Install and start server if needed
[19:58:09.164] Checking ssh with "ssh -V"
[19:58:09.186] > OpenSSH_7.6p1 Ubuntu-4ubuntu0.3, OpenSSL 1.0.2n 7 Dec 2017
[19:58:09.188] askpass server listening on /run/user/1000/vscode-ssh-askpass-cfa7f897a39b00f982c913953e2f0b4a69d8a1a4.sock
[19:58:09.189] Spawning local server with {"ipcHandlePath":"/run/user/1000/vscode-ssh-askpass-357e3b838994d0c2d8588f1d0deab8c67b433f0a.sock","sshCommand":"ssh","sshArgs":["-v","-T","-D","39511","-o","ConnectTimeout=15","google_colab_ssh"],"dataFilePath":"/home/thunderclap/.config/Code/User/globalStorage/ms-vscode-remote.remote-ssh/vscode-ssh-host-google_colab_ssh-ff915844119ce9485abfe8aa9076ec76b5300ddd-0.51.0/data.json"}
[19:58:09.189] Local server env: {"DISPLAY":"1","ELECTRON_RUN_AS_NODE":"1","SSH_ASKPASS":"/home/thunderclap/.vscode/extensions/ms-vscode-remote.remote-ssh-0.51.0/out/local-server/askpass.sh","VSCODE_SSH_ASKPASS_NODE":"/usr/share/code/code","VSCODE_SSH_ASKPASS_MAIN":"/home/thunderclap/.vscode/extensions/ms-vscode-remote.remote-ssh-0.51.0/out/askpass-main.js","VSCODE_SSH_ASKPASS_HANDLE":"/run/user/1000/vscode-ssh-askpass-cfa7f897a39b00f982c913953e2f0b4a69d8a1a4.sock"}
[19:58:09.195] Spawned 6947
[19:58:09.263] > local-server> Spawned ssh: 6955
[19:58:09.265] stderr> OpenSSH_7.6p1 Ubuntu-4ubuntu0.3, OpenSSL 1.0.2n 7 Dec 2017
[19:58:26.197] Terminating local server
[19:58:26.203] Resolver error: Connecting with SSH timed out
[19:58:26.216] ------

[19:58:26.219] Local server exit: 15

Is ssh-via-cloudflared still working now? [2021-04-06]

Hello,

I am using Colab-ssh before and it is working well.

Today I am trying to use the same notebook and it shows following error:

port 22: Connection timed out

I would like to confirm if there is a problem with Colab right now?

A fix for "Not working" problem

A fix for "not working" problem

Solution

For users:

Execute apt update before trying to install openssh-server

!apt update

or

import os
os.system("apt update")

For developer&maintainers:

Add the code below into launch_ssh.py above line 38

# Refresh apt database
os.system("apt-get update 2>&1 >/dev/null")

Create a VS Code link to the current working directory

The Issue

initi_git assumes that the repository is always cloned into the /content directory, creating an incorrect link for VS Code when it is not.

The Solution

Replace /content with the current working directory, {os.getcwd()}, in the link creation line:

link = f"vscode://vscode-remote/ssh-remote+root@{output['domain']}:{output['port']}{os.getcwd()}/{repo_name}"

Error opening repository with the name ending with g

Describe the bug
A clear and concise description of what the bug is.
On init_git, the way the repository name is extracted from the repositoryUrl causes repo names ending with g to cut the ending. This causes the option [Optional] You can open the cloned folder using VSCode, by clicking <repo-name> to open a non existing directory.

To Reproduce
Steps to reproduce the behavior:

  1. Run init_git on a repository with the name ending with g. for example dive-into-deep-learning

  2. Click on [Optional] You can open the cloned folder using VSCode, by clicking dive-into-deep-learnin

  3. VScode will open the connection with the workspace as Unable to resolve workspace folder

  4. See error

git_url = 'git://github.com/flych3r/dive-into-deep-learning.git'
repo_name = os.path.basename(git_url).rstrip(".git") 
print(repo_name)
>>> dive-into-deep-learnin

Expected behavior
The repository name should remain correct. Clicking on open should open the folder of the cloned repository.

Screenshots
If applicable, add screenshots to help explain your problem.
Captura de tela de 2020-07-16 13-10-59

SSH not connecting (cloudflare and ngrok)

Describe the bug
SSH tunnnel not connecting either by SSH tunnel in terminal or VS code. VSCode is executed as root user.

To Reproduce

Expected behavior

Screenshots
image

Questions
Is Colab blocking SSH tunnel? If I try to connect either by ngrok or cloudflare, the ssh tunnel is rejected by remotehost. I used it last night (28.01.2021) and it worked just fine.

VS Code Integration Broken

Describe the bug
The July 27th Release appears to have broken my interaction with VS Code + colab_ssh..

I'm not sure whether this release was required to fix something that had changed on VS Code / Colab side?
I have set up my repo exactly as described in your instructions - I have used this colab script 100's of times and it's always worked - it broke on 27th.

To Reproduce
Steps to reproduce the behavior:
From Colab click either "open in vs code" or Copy-Paste the https address into VS Code "Open Remote Host"

Expected behavior
I'd expect it to connect to colab via SSH

Screenshots
Here's the view from VS Code:
image
Screenshot 2021-07-28 at 13 33 55

SSH Log before it times out:

[13:43:37.238] SSH Resolver called for "ssh-remote+https://conversion-city-tones-sewing.trycloudflare.com", attempt 1
[13:43:37.239] "remote.SSH.useLocalServer": true
[13:43:37.239] "remote.SSH.path": undefined
[13:43:37.239] "remote.SSH.configFile": undefined
[13:43:37.239] "remote.SSH.useFlock": true
[13:43:37.239] "remote.SSH.lockfilesInTmp": false
[13:43:37.239] "remote.SSH.localServerDownload": auto
[13:43:37.240] "remote.SSH.remoteServerListenOnSocket": false
[13:43:37.240] "remote.SSH.showLoginTerminal": false
[13:43:37.240] "remote.SSH.defaultExtensions": []
[13:43:37.240] "remote.SSH.loglevel": 2
[13:43:37.240] SSH Resolver called for host: https://conversion-city-tones-sewing.trycloudflare.com
[13:43:37.240] Setting up SSH remote "https://conversion-city-tones-sewing.trycloudflare.com"
[13:43:37.243] Acquiring local install lock: /var/folders/m7/y15hbqns7v5gbmb9ycqrkf7w0000gn/T/vscode-remote-ssh-https:/conversion-city-tones-sewing.trycloudflare.com-install.lock
[13:43:38.745] Starting to look for password prompt from another window

I realise this is likely more an issue on VS Code side, it looks like it's struggling to aquire the lock required to download the .vscode-server package on the remote.

Any suggestions would be much appreciated.

Best,
Liam

Ability to include ngrok region along with token

Firstly , i am pretty new to your repo, really great work . it worked perfectly in first try
i just had one feature request

ngrok has different regions namely these :
us - United States (Ohio)
eu - Europe (Frankfurt)
ap - Asia/Pacific (Singapore)
au - Australia (Sydney)
sa - South America (Sao Paulo)
jp - Japan (Tokyo)
in - India (Mumbai)

choosing the nearest location helps us to reduce the latency ( its important because we are already not using colab natively so theres a obvious delay as everything going through ngrok server but its good to reduce delay as much as possible ), i am not really sure what ngrok region does your script automatically choose but it would be a very good inclusion to manually choose location in launchssh function

i meant something like

# Install colab_ssh
!pip install colab_ssh --upgrade

from colab_ssh import launch_ssh, init_git
launch_ssh(ngrokToken,ngrokRegion,password)

ngrokregion can then accept us , eu , ap , au ,sa, jp ,in corresponding to their countries

Edit - i just checked my ngrok tunnel region and its set to US, i think the script automatically sets tunnel region to US
https://dashboard.ngrok.com/status/tunnels

Missing environment variables

I found a bunch more environment variables that would be useful to have set in the ssh session:

CUDA_VERSION': '10.1.243'
'CUDA_PKG_VERSION': '10-1=10.1.243-1'
'CUDNN_VERSION': '7.6.5.32'
'TPU_NAME': 'grpc://10.117.35.210:8470', 
'TBE_CREDS_ADDR': '172.28.0.1:8008',
'XLA_FLAGS': ' --xla_cpu_enable_fast_math=false'}) 
'XRT_TPU_CONFIG': 'tpu_worker;0;10.96.199.218:8470

These are set in the web and are required for using TPUs.

Spurious IndexError

Occasionally I'm getting this IndexError when running `launch_ssh('', '')

/usr/local/lib/python3.6/dist-packages/colab_ssh/launch_ssh.py in launch_ssh(token, password, publish)
     47     publish_host(info[0].decode().strip())
     48 
---> 49   if info[0]:
     50     # Extract the host and port
     51     host_and_port = re.match(r'.*://(.*):(\d+)\n', info[0].decode())
IndexError: list index out of range

[alternative solution] Allow ssh access through ssh-key directly through launch_ssh_cloudflared()

Is your feature request related to a problem? Please describe.
This is a not problem, but typing password every times is a bit bothersome.

Describe the solution you'd like
Allow public key to be specified directly in launch_ssh_cloudflared(), as an alternative to password.

And I think it can be cone easily by,

pubkey = 'ssh-rsa INSERT PUBLIC KEY HERE'
with open('/root/.ssh/authorized_keys', 'w') as text_file:
    print('{}'.format(pubkey), file=text_file

Describe alternatives you've considered
I think this could be an easier solution than having to copy them in the git repository and call init_git_cloudflared()

Any available cloudflared binary for arm64 (aarch64) ?

Its been quite a long time since i last used colab . After the ngrok issue , i am trying it for first time currently

Majority of the times i use colab ssh on my android device. This URL for downloading the binaries - https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/install-and-setup/installation doesn't list any arm64 /aarch64 binary which i can use in termux ? It has quite limited set of binaries . One is amd64/x86 which would work in desktop , Other two are 32 bit ones which most devices now don't even use . Is there any way out ?

Add support for Gitlab repos

Is your feature request related to a problem? Please describe.
Add support to clone Gitlab repos.

Describe the solution you'd like
The solution would work with the same current interface, just different parameter values.

Describe alternatives you've considered
I've implemented a solution and tested it using Google Colab. I will open a PR so that you can review the proposed changes.

Additional context
I added some unit tests, but when I try to run them using pytest within the devcontainer, I get this error:

import apt
E   ModuleNotFoundError: No module named 'apt'

Edit: I tested the authorized_keys functionality and found I introduced some bugs which are now fixed. I left the fixes as individual commits so that you can review the changes. However, these would need to be squashed.

Add a Desktop Environment + VNC support

Desktop environment support with VNC could very well be added . It will help people who intend to use OpenGl programs or just need GUI for some task not suited through command line. TurboVNC can be easily used for this purpose and it can be accessed through any VNC client. As far as DE is concerned , Xfce can be used being the lightest among all . If you need a reference for this implementation , just let me know , i will share the link

NameError: name 'password' is not defined

Describe the bug
The tunnel does not start and gives a "not defined error"

To Reproduce
Steps to reproduce the behavior:

  1. Create new code cell.
  2. Paste this:
# Install colab_ssh on google colab
!pip install colab_ssh --upgrade

from colab_ssh import launch_ssh_cloudflared, init_git_cloudflared
launch_ssh_cloudflared(password)
  1. Run the cell.

Expected behavior
Client machine configuration prompt should appear.

Screenshots
image

Name password not defined

I got the above report when the

# Install colab_ssh on google colab
!pip install colab_ssh --upgrade

from colab_ssh import launch_ssh_cloudflared, init_git_cloudflared
launch_ssh_cloudflared(password)

# Optional: if you want to clone a github repository
init_git_cloudflared(githubRepositoryUrl)

On colab

Prevent SSH idle timeout / disconnection

Whenever i am connected to google colab using ssh , after like every 5,10 minutes i get disconnected
i have to again and again open my browser and open google colab website and setup everything again and connect using the newer port

For people who use google colab through their browser only , theres a trick to avoid getting disconnected

function ClickConnect(){
console.log("Working"); 
document.querySelector("#top-toolbar > colab-connect-button").shadowRoot.querySelector("#connect").click()
} 
setInterval(ClickConnect,60000)

This javascript code keeps on tapping at connect button every minute , so once a colab is started it goes on to run for maximum 12 hours which is the limit itself

i was wondering if anything can be done in regards to SSH because disconnections are very frequent once you have closed your browser and only accessing colab via ssh client

Cannot connect using VSCode

When connecting through VSCode, I encounter this error
image

But when connecting through the terminal or the Command line, it connects without a problem.

Shell latency

Hi, I have started using this package and I think its great!

While working on the console, I noticed quite a bit of a latency (letters appear about 100-200ms after typing).

Is that normal? Do yo have an idea how to tackle it? I dont know if thats relevant, but im located in germany.

Cheers.

Can't connect to colab: dial tcp: no such host

Describe the bug
Can't connect to colab neither with VS code nor through terminal. Looks like cloudflare can't resolve hostname.

To Reproduce
Steps to reproduce the behavior:

  1. !pip install colab_ssh --upgrade
  2. from colab_ssh import launch_ssh_cloudflared
  3. launch_ssh_cloudflared(password="")
  4. Connect either from terminal (ssh manufacture-currently-hall-supporters.trycloudflare.com) or VS code

Expected behavior
Connection is established.

Actual behavior

(base) PS C:\Users\username\Documents\bin> ssh manufacture-currently-hall-supporters.trycloudflare.com
dial tcp: lookup manufacture-currently-hall-supporters.trycloudflare.com: no such host
ssh_exchange_identification: Connection closed by remote host

I also tried to execute this command:

(base) PS C:\Users\username> C:\Users\username\Documents\bin\cloudflared.exe access ssh --hostname manufacture-currently-hall-supporters.trycloudflare.com
dial tcp: lookup manufacture-currently-hall-supporters.trycloudflare.com: no such host

What could be the problem? Maybe, I have something wrong with my configuration? (though it worked previously).

Versions
cloudflared version 2020.12.0 (built 2020-12-08-2302 UTC)
Windows 10

Exception: It looks like something went wrong, this might be a problem with cloudflared

I'm getting the following Exception when running this line launch_ssh_cloudflared(password)

---------------------------------------------------------------------------
Exception                                 Traceback (most recent call last)
/usr/local/lib/python3.6/dist-packages/colab_ssh/launch_ssh_cloudflared.py in launch_ssh_cloudflared(password, verbose, kill_other_processes)
     58     try:
---> 59         info = get_argo_tunnel_config()
     60     except:

2 frames
Exception: Cannot get the hostname from cloudflared, it looks like the connection has failed.

During handling of the above exception, another exception occurred:

Exception                                 Traceback (most recent call last)
/usr/local/lib/python3.6/dist-packages/colab_ssh/launch_ssh_cloudflared.py in launch_ssh_cloudflared(password, verbose, kill_other_processes)
     60     except:
     61         raise Exception(
---> 62             "It looks like something went wrong, this might be a problem with cloudflared")
     63 
     64     if verbose:

Exception: It looks like something went wrong, this might be a problem with cloudflared

Unable to connect Colab via colab_ssh using GPU runtime

Describe the bug
I created a new notebook on colab using a runtime with GPU as hardware acelerator, and at the moment of connecting to colab-ssh

To Reproduce
Steps to reproduce the behavior:

  1. Go to https://colab.research.google.com/
  2. Create a new notebook
  3. Click on Runtime -> Change runtime type -> GPU
  4. Execute colab_ssh.launch_ssh('token', 'password')
  5. See error

Expected behavior
I was expecting that there were no problem connecting to a runtime with GPU enable and then and then that I was going to use GPU for doing some research via ssh.

Full traceback error
ConnectionRefusedError Traceback (most recent call last)
/usr/local/lib/python3.6/dist-packages/urllib3/connection.py in _new_conn(self)
158 conn = connection.create_connection(
--> 159 (self._dns_host, self.port), self.timeout, **extra_kw)
160

22 frames
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

NewConnectionError Traceback (most recent call last)
NewConnectionError: <urllib3.connection.HTTPConnection object at 0x7fcc545f7f60>: Failed to establish a new connection: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

MaxRetryError Traceback (most recent call last)
MaxRetryError: HTTPConnectionPool(host='localhost', port=4040): Max retries exceeded with url: /api/tunnels (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fcc545f7f60>: Failed to establish a new connection: [Errno 111] Connection refused',))

During handling of the above exception, another exception occurred:

ConnectionError Traceback (most recent call last)
ConnectionError: HTTPConnectionPool(host='localhost', port=4040): Max retries exceeded with url: /api/tunnels (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fcc545f7f60>: Failed to establish a new connection: [Errno 111] Connection refused',))

During handling of the above exception, another exception occurred:

Exception Traceback (most recent call last)
/usr/local/lib/python3.6/dist-packages/colab_ssh/launch_ssh.py in launch_ssh(token, password, publish, verbose, region, remote_addr)
75 except:
76 raise Exception(
---> 77 "It looks like something went wrong, please make sure your token is valid")
78
79 if verbose:

Exception: It looks like something went wrong, please make sure your token is valid

Also
I've already checked that there's no problem with my token, I've created a new one and the error persist.

Permission denied: './cloudflared'

What i got:

Requirement already satisfied: colab_ssh in /usr/local/lib/python3.6/dist-packages (0.3.13)
DEBUG: Skipping installation of openssh-server, package already installed
---------------------------------------------------------------------------
PermissionError                           Traceback (most recent call last)
<ipython-input-9-633fb44046af> in <module>()
     11 
     12 from colab_ssh import launch_ssh_cloudflared, init_git_cloudflared
---> 13 launch_ssh_cloudflared(password)
     14 
     15 # Optional: if you want to clone a github repository

2 frames
/usr/lib/python3.6/subprocess.py in _execute_child(self, args, executable, preexec_fn, close_fds, pass_fds, cwd, env, startupinfo, creationflags, shell, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite, restore_signals, start_new_session)
   1362                         if errno_num == errno.ENOENT:
   1363                             err_msg += ': ' + repr(err_filename)
-> 1364                     raise child_exception_type(errno_num, err_msg, err_filename)
   1365                 raise child_exception_type(err_msg)
   1366 

**PermissionError: [Errno 13] Permission denied: './cloudflared'**

What i run:

from colab_ssh import launch_ssh_cloudflared, init_git_cloudflared
launch_ssh_cloudflared(password)

PS: this happens just starting from yesterday

bad handshake

Describe the bug
the connection does not wor (and fail for me) on osx with:


ssh measurement-situations-designated-scientists.trycloudflare.com
2021-09-12T17:13:10Z ERR failed to connect to origin error="websocket: bad handshake" originURL=https://measurement-situations-designated-scientists.trycloudflare.com
websocket: bad handshake
kex_exchange_identification: Connection closed by remote host

after setting up the SSH config file as suggested in the client machine configuration by launch_ssh_cloudflared

To Reproduce
Steps to reproduce the behavior:

  1. Go to colab
  2. install & launch launch_ssh_cloudflared: !pip install colab_ssh --upgrade
    2.1 imports: from colab_ssh import launch_ssh_cloudflared
  3. set up the host as suggested by the UI
  4. Try to connect and see error

Expected behavior
a working SSH connection

Sponsor button is broken (Github only)

Describe the bug
Funding.yml cant be parsed because user is not enrolled in Github Sponsors

To reproduce
Click the sponsor button in the repo

Screenshots
image

How can we stop keyboard interrupt in colab from breaking SSH?

Is your feature request related to a problem? Please describe.

First off, thank you so much for the fix to the recent changes that broke ngrok. You made it very easy to get it working again with cloudflared.

When I interrupt a cell in colab it also interrupts the SSH connection and causes VSCode Remote to disconnect from Colab. This then means I have to go run launch_ssh_cloudflared(password) again, wait for it to load, copy the new cloudflared url and reconnect to colab again, then navigate back to my working folder, entering the password twice.

Describe the solution you'd like

The ability to interrupt cells in colab without breaking the SSH connection.

Describe alternatives you've considered
-Trying to get ngrok working again so I could use a static TCP address that makes reconnecting faster

  • Running the process in the background by putting the cloudflared command in a script called ssh.py and running !nohup python3 start_ssh.py &, then reading the cloudflared URL out of ssh_details via regex from nohup.out.

Additional context
I'm happy to help with this or PR myself if I get a solution, I'm just not sure where to go from here.

cannot establish connection to jurisdiction-influences-opposite-external.trycloudflare.com

hello bros, I follow the readme instruction to setup colab ssh connection on vscode without success. I initially used vscode 1.52(latest), I uninstall it and install 1.50 but without success as well.
this is my ./ssh/ setting on my windows 10:
Host *.trycloudflare.com
HostName %h
User root
Port 22
ProxyCommand "C:\Users\MINISTRY OF HEALTH\Downloads\cloudflared-stable-windows-amd64" access ssh --hostname %h

When I tried to connect to colab, I received these error

Logs
[13:40:46.051] Log Level: 2
[13:40:46.063] [email protected]
[13:40:46.063] win32 x64
[13:40:46.070] SSH Resolver called for "ssh-remote+jurisdiction-influences-opposite-external.trycloudflare.com", attempt 1
[13:40:46.074] "remote.SSH.useLocalServer": false
[13:40:46.077] "remote.SSH.showLoginTerminal": false
[13:40:46.078] "remote.SSH.remotePlatform": {"host-in-ssh-config-or-fqdn":"windows"}
[13:40:46.079] "remote.SSH.sshPath": undefined
[13:40:46.079] "remote.SSH.sshConfigurationFile": undefined
[13:40:46.080] "remote.SSH.useFlock": true
[13:40:46.080] "remote.SSH.lockfilesInTmp": false
[13:40:46.081] "remote.SSH.localServerDownload": auto
[13:40:46.096] "remote.SSH.remoteServerListenOnSocket": false
[13:40:46.096] "remote.SSH.showLoginTerminal": false
[13:40:46.097] "remote.SSH.maxReconnectionAttempts": 9007199254740991
[13:40:46.098] SSH Resolver called for host: jurisdiction-influences-opposite-external.trycloudflare.com
[13:40:46.098] Setting up SSH remote "jurisdiction-influences-opposite-external.trycloudflare.com"
[13:40:46.249] Using commit id "d2e414d9e4239a252d1ab117bd7067f125afd80a" and quality "stable" for server
[13:40:46.263] Install and start server if needed
[13:40:49.903] Checking ssh with "ssh -V"
[13:40:50.301] > OpenSSH_for_Windows_8.1p1, LibreSSL 2.9.2

[13:40:50.328] Remote command length: 7252/8192 characters
[13:40:50.336] Running script with connection command: ssh -T -D 49960 "jurisdiction-influences-opposite-external.
trycloudflare.com" powershell -ExecutionPolicy Unrestricted -NoLogo -NoProfile -NonInteractive -Command "powershell 
-ExecutionPolicy Unrestricted -NoLogo -NoProfile -NonInteractive -EncodedCommand $([Convert]::ToBase64String([Text.
Encoding]::Unicode.GetBytes([Text.Encoding]::UTF8.GetString([Convert]::FromBase64String
('CiR1dWlkPSI0NmJhMGVhN2MyOGMiCiIke3V1aWR9OiBydW5uaW5nIgokUHJvZ3Jlc3NQcmVmZXJlbmNlPSdTaWxlbnRseUNvbnRpbnVlJwokbj0nZDJlNDE0
ZDllNDIzOWEyNTJkMWFiMTE3YmQ3MDY3ZjEyNWFmZDgwYScKJHA9JGVudjpQUk9DRVNTT1JfQVJDSElURUNUVVJFCiRhcmNoPWlmICgoJHAgLWVxICdBTUQ2NC
cpIC1vciAoJHAgLWVxICdJQTY0JykpIHsgJ3g2NCcgfSBlbHNlIHsgJ2lhMzInIH0KJG89KEpvaW4tUGF0aCAoUmVzb2x2ZS1QYXRoIH4pICcudnNjb2RlLXNl
cnZlcicpCiRlbnY6VlNDT0RFX0FHRU5UX0ZPTERFUj0kbwokbG9nPSIkb1wuJG4ubG9nIgokc0Rpcj0iJG9cYmluXCRuIgokcD0nc3RhYmxlJwokcT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xzCiIke3V1aWR9OiBlbmQiCiJJbnN0YWxsIHNjcmlwdCBpcyAkcGlkLCB3YXRjaGluZyBzc2h
kIHBhcmVudCAkc3NoZFBJRCIKd2hpbGUgKCRUcnVlKSB7CmIKc2xlZXAgMzAKfQo=')))))"  # RemoteSSHConfigurationScript
[13:40:50.347] Terminal shell path: C:\Windows\System32\cmd.exe
[13:40:50.834] > 
[13:40:50.836] Got some output, clearing connection timeout
[13:40:51.086] > CreateProcessW failed error:5
> posix_spawnp: Input/output error
> 
[13:40:51.358] "install" terminal command done
[13:40:51.360] Install terminal quit with output: posix_spawnp: Input/output error
[13:40:51.360] Received install output: posix_spawnp: Input/output error
[13:40:51.363] Stopped parsing output early. Remaining text: posix_spawnp: Input/output error
[13:40:51.363] Failed to parse remote port from server output
[13:40:51.383] Resolver error: Error: 
	at Function.Create (c:\Users\MINISTRY OF HEALTH\.vscode\extensions\ms-vscode-remote.remote-ssh-0.61.0\out\extension.
js:1:82322)
	at Object.t.handleInstallOutput (c:\Users\MINISTRY OF HEALTH\.vscode\extensions\ms-vscode-remote.remote-ssh-0.61.
0\out\extension.js:1:78935)
	at I (c:\Users\MINISTRY OF HEALTH\.vscode\extensions\ms-vscode-remote.remote-ssh-0.61.0\out\extension.js:127:107056)
	at processTicksAndRejections (internal/process/task_queues.js:94:5)
	at async c:\Users\MINISTRY OF HEALTH\.vscode\extensions\ms-vscode-remote.remote-ssh-0.61.0\out\extension.js:127:104971
	at async Object.t.withShowDetailsEvent (c:\Users\MINISTRY OF HEALTH\.vscode\extensions\ms-vscode-remote.remote-ssh-0.
61.0\out\extension.js:127:110308)
	at async Object.t.resolve (c:\Users\MINISTRY OF HEALTH\.vscode\extensions\ms-vscode-remote.remote-ssh-0.61.
0\out\extension.js:127:108372)
	at async c:\Users\MINISTRY OF HEALTH\.vscode\extensions\ms-vscode-remote.remote-ssh-0.61.0\out\extension.js:127:129627
[13:40:51.404] ------

</details>

where am i getting it wrong


The COLAB_TPU_ADDR environment variable is not set

This environment variable is important to have to use TPUs. It is set in the interactive notebook but appears to not be copied over to .bashrc so from ssh you can't use TPU. It would be good if the variable was added.

Warn against usage on other platforms.

This is not a feature request. This is more of a warning that's "good to have".

Although the repository clearly states that it's built for Google Colab, I recently tried using colab-ssh on Paperspace Gradient. As soon as I ran the relevant cell, my account was deactivated and I had to contact support to get it restored. I landed into trouble because Paperspace doesn't support ssh tunneling on Gradient notebooks.

I'm pretty sure that I'm not the first person to do so. I'm also sure that there will be others like me repeating the same mistake in the future. Keeping in mind the larger benefit of the community, It would be a good addition to warn users against such kind of usage.

I guess there can be a section in the README which does so. I can also submit a PR if that's okay with the devs.

Exception: It looks like something went wrong, please make sure your token is valid

Describe the bug
When trying to execute the line
launch_ssh_cloudflared(password='my-pass')
this error rises:

 ---------------------------------------------------------------------------
 Exception                                 Traceback (most recent call last)
 <ipython-input-2-3bf4ca11c226> in <module>()
       5 
       6 from colab_ssh import launch_ssh_cloudflared, init_git_cloudflared
 ----> 7 launch_ssh_cloudflared(password='my-pass')
       8 init_git_cloudflared("https://github.com/me/my-repo", personal_token='', branch="master", username="me")
 
 /usr/local/lib/python3.7/dist-packages/colab_ssh/launch_ssh_cloudflared.py in launch_ssh_cloudflared(password, verbose, prevent_interrupt, kill_other_processes)
     134         print(proc.stdout.readlines())
     135         raise Exception(
 --> 136             "It looks like something went wrong, please make sure your token is valid")
     137     proc.stdout.close()
 
Exception: It looks like something went wrong, please make sure your token is valid

I have been using this approach for some time now, and this is the first time it arises...

To Reproduce
Steps to reproduce the behavior:
Connect to a colab instance (GPU) and run the following code (replacing passwords, github links to repos, and other personal info):

from google.colab import drive
drive.mount('/root/gdrive')
!pip install colab_ssh --upgrade
password = 'my-pass'

from colab_ssh import launch_ssh_cloudflared, init_git_cloudflared
launch_ssh_cloudflared(password=password)
init_git_cloudflared("https://github.com/me/my-repo", personal_token='my-git-personal-token', branch="master", username="me")

Expected behavior
Create the ssh tunnel as stated on the documentation

Screenshots
Screenshot from 2021-07-27 11-52-11

will there be any bug due to change of github username previously?

while I am trying to launch init_git_cloudflared its throwing error saying [git::ERROR] fatal: Remote branch main not found in upstream origin saying I need to check my username and password. I checked everything on my side. Is there any possibility that my change of username previously effects this code. I even tried with both old username and new one. both are failing. Its entirely possible that I am getting this error because of lack of knowledge from side. please ignore if it doesnt make any sense. thank you.

Environment variables only available in interactive shells

It looks like environment variables are added to the .bashrc file. The commands in this file are only run if bash is running as a login shell and interactively. If you try to automate ssh access to Colab then bash is not running interactively so the commands are not run. Therefore the environment variables do not get set.

I think it would be better to put the environment variables in /etc/environment so that they are available to non-interactive shells.

VSCode Remote SSH extension

Describe the bug
It's hard to figure out that using VSCode SSH link requires the VSCode Remote SSH Extension.

Expected behavior
The documentation should mention that you need the VSCode Remote SSH extension in order to use SSH connection on VSCode.

`cloudflared-stable-linux` download link broken

Hello,

The download link of cloudflared-stable-linux is already broken as I just tested.

"wget -q -nc https://bin.equinox.io/c/VdrWdbjqyF/cloudflared-stable-linux-amd64.tgz")

Below is the test result,

wget  -nc https://bin.equinox.io/c/VdrWdbjqyF/cloudflared-stable-linux-amd64.tgz
--2021-10-12 01:39:49--  https://bin.equinox.io/c/VdrWdbjqyF/cloudflared-stable-linux-amd64.tgz
Resolving bin.equinox.io (bin.equinox.io)... 54.237.133.81, 54.161.241.46, 52.202.168.65, ...
Connecting to bin.equinox.io (bin.equinox.io)|54.237.133.81|:443... connected.
HTTP request sent, awaiting response... 404 Not Found
2021-10-12 01:39:51 ERROR 404: Not Found.

Customizing SSHConfig to minimize friction

Is your feature request related to a problem? Please describe.
The problem is extremely minor and something I can live with, but ideally would be able to solve since I connect to colab almost every day. Please let me know if any of the issues below are solved and if they would be desired features/improvements. Thank you.

The issue is that I need to do the following steps when connecting.

  1. Choose the operating system of my remote (it's always Linux)
  2. Enter my password
  3. Navigate to my projects root folder (almost always the same project) and open that folder in vscode
  4. Enter my password again
  5. Known hosts file gets bloated with all these one time use cloudflare addresses.

Describe the solution you'd like
I'd like to do the following and then PR it into the readme as an advanced setup so everyone can do it. I'd be happy to add to the advanced readme other tips and tricks I've figured out like port forwarding

  1. Find a way to set the operating system of *.trycloudflare.com to linux automatically so it stops asking.
    2-4. Find a way to not have to use a password
  2. Find a way to set the home folder in SSHConfig (I think I can do this with RemoteCommand)
  3. This can be done by setting the UserKnownHostsFile to /dev/null for *.trycloudflare.com in the SSH config file (for Linux) or to C:\Users<Username>.ssh\tmp\known_hosts for windows (you must manually create the tmp folder)

Describe alternatives you've considered

  1. I researched this heavily and it can be set via the remote.SSH.remotePlatform in VSCode but it currently doesn't support wildcards. There is an open feature request
  2. I tried googling. I also tried setting password to empty string but it doesn't work.
  3. I tried RemoteCommand cd path/to/folder && code . and it wasn't working, I tried creating a cell that writes and sources a .bashrc file but it says the code command can only be launched from WSL or code terminal.
  4. Solved above

Ask for username and password when cloning private repositories without personal tokens.

The issue
The documentation for init_git says that personal tokens aren't required while cloning personal repositories. When I try to clone a private repository without a personal token, I get the wrong message that the repository has successfully been cloned. Instead I expect a prompt that asks for my username and password. I guess this information is not being relayed properly to the user.

Steps to reproduce

! pip install colab_ssh
from colab_ssh import launch_ssh, init_git
launch_ssh('ngrok_token', 'password')
init_git('https://github.com/johndoe/private-repository.git', username='John Doe', email='[email protected]')

What I should see*
At this point, I expect to see a prompt which asks for my github username and password. But what I get is the following.

What I actually see

Requirement already satisfied: colab_ssh in /usr/local/lib/python3.6/dist-packages (0.2.60)
Successfully running 0.tcp.ngrok.io:10000
[Optional] You can also connect with VSCode SSH Remote extension using this configuration:

	Host google_colab_ssh
		HostName 0.tcp.ngrok.io
		User root
		Port 10000
	  
Successfully cloned the repository
[Optional] You can open the cloned folder using VSCode, by clicking private-repository

Suggestions
Personal tokens should either be mandatory when cloning personal repositories, or the user should be asked for their GitHub username and password when personal tokens are not specified.

Support for Reserved TCP Addresses

I have access to an Ngrok reserved TCP address which would allow me to not have to update my .ssh_config every time I start a new session with colab_ssh. It would be great if a reserved TCP address were an optional argument to launch_ssh

I monkey patched launch_ssh to work with a reserved TCP address by editing the underlying Popen command to include an argument for remote address and it worked. It would take a bit more work since it would be an optional argument, but it seems pretty straightforward.
proc = Popen(shlex.split('./ngrok tcp --authtoken {} --region {} --remote-addr {} 22'.format(token, region, my_reserved_tcp)), stdout=PIPE)

If you think it would be useful please add it, or let me know if you prefer I submit a PR. Thanks for your awesome work on this project, it has made colab so much more usable!

Ngrok docs on reserved remote addresses

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.