Connect Google Colab via Remote Desktop | Updated To v2

Pradyumna Krishna
3 min readSep 28, 2020
Story Thumbnail

Yesterday, I tried to connect Google Colab via Remote Desktop and after many attempts, I succeeded. I want to thank this google article, which helped me in doing so.

Warning: Don’t use it for Cryptocurrency Mining. Which is against the policy of Google Colab, and you will get banned from Google Colaboratory.

Before We Start

Google Colab is mostly used to perform heavy tasks like Training TensorFlow Model, Data analysis, Machine Learning and Deep Learning. You can get an Instance with 12GB RAM and GPU for free upto 12 hours. You can use it to perform heavy tasks, and access google drive to store your data.

Now Let’s Begin

Update: New Script One Click RDP. It can make Colab Instance ready for Remote Connection in only one click. No need to follow the procedure. No NGROK Required @ Same Notebook.

I used Google Remote Desktop and Ngrok Tunnel for RDP in Google Colab Instance. You can use my notebook for connecting Google Colab via Remote Desktop.

New Method:

  1. Open the Notebook in Google Colab.
  2. Create user account using appropriate code block.*
    *Don’t use username: root
  3. Paste the Chrome Remote Desktop Authentication Code in RDP code block and run it. (This will complete setup in only few minutes)
  4. Optional: Mount Google Drive for Persistent Data.

How-To:

  1. First, create a user account and add a password:
    Use useradd and adduser commands for user account creation and passwd command to change the account’s password.
  2. Create and Run the Ngrok Tunnel:
    Use the colab_ssh library for creating Ngrok Tunnel.
  3. Configure Instance:
    Install Chrome Remote Desktop Headless, Desktop Environment and other required tools like browser, terminal.
  4. SSH the Colab Instance.
  5. Visit Chrome Remote Desktop and start the process:
    Open a browser and go to http://remotedesktop.google.com/headless.
  6. Don’t Download any file; proceed directly and click to authenticate button.
  7. When you get a command, copy and paste it to the SSH terminal and complete the process by setting up a pin.

Now you can see the newly available Colab Instance in Remote Devices present at Chrome Remote desktop. As shown in the image:

Colab Instance under Remote Devices present at Chrome Remote desktop.

I have done more similar things with Google Colab, Which you can get from my Repository Colab Hacks.

Video Tutorial

Thanks for 1K+ views, I hope you found this helpful and thanks for reading it. I think you might be interested in reading my other articles.

To get updates to similar content follow me or visit on my LinkedIn and Twitter. See you this Fall on Youtube 🧑‍💻.

--

--