Do you have a great desktop, but don't want to shell out premium dollars for a MacBook Pro, only to have security concerns around your beautiful laptop getting stolen? If you feel great when you accomplish something complex, and you want a super-inexpensive backup computer that gives you both freedom and power to develop from your favorite cafe, read on!
In the early days, web development meant local file changes which were sent to the server via FTP. Shelling into the remote server directly was rarely ideal – but technology has come a long way. Chromebooks, starting around $170, have up to 13 hours of battery life and weigh just about 2 lbs. The operating system is designed to run a web browser and nothing else: even your file storage is in the cloud. Enter Cloud9.
Cloud9's web-based IDE is strikingly powerful, feature-rich, and performant on a Chromebook 11. C9 has Goto Anything, rather comprehensive Vim support, and many other power-user accessories. While the public-facing https://c9.io requires a premium subscription for SSH workspaces (which once was $9 a month and is now $19 a month), Cloud9 does offer a downloadable package that you can host yourself.
Note: Cloud9's standalone ("host it yourself") version is their alpha SDK for non-commercial purposes. There may be dragons. Always feel free to fork the project and send pull requests if you find-and-fix any bugs.
- Assumptions and Conventions
- Set Up Cloud9
- Set Up an SSH Server
- Key-Based Authentication
- Establish SSH Tunnel Local Port Forwarding
- Open a Project in Cloud9
- SOCKSv5 for DNS Resolution
- Embrace Victory
For this article, we will assume that you already have a working development environment (complete with Node and Git) hosted on a server you can install onto. This server could be your home workstation, a DigitalOcean droplet, or something else. Additionally, I assume you have working knowledge of your operating system of choice, as well as some command-line fu.
http://memegenerator.net/instance/64225164
http://muppet.wikia.com/wiki/Cloud_Nine
You can set up Cloud9 anywhere on your server. The first step is to pick a location and clone down the self-hosted version of Cloud9 (they call it their "SDK"). I'm installing mine in my home directory.
$ cd /home/<user>
$ git clone git://github.com/c9/core.git c9
The installation is taken care of by the install script that comes with the repo, so let's go into our newly created c9 folder and run the install script.
$ cd c9
$ scripts/install-sdk.sh
Assuming no unforseen complications, the install script will complete, and return you to your command line. To test that everything works, you can simply run the c9 server:
$ node server.js
You should see a line that says something like: Connect server listening at http://127.0.0.1:8181 – type this full URL (including the :8181) into your browser. You should see your new c9 development environment!
Hit Ctrl+C in the terminal window to stop the process for now.
Note: If you want to have a more secure server, I recommend following the DigitalOcean initial server setup tutorial.
A basic SSH server in Debian 8 is relatively simple to set up. If the SSH server is not already installed for you during setup (or you're simply not sure), the package is called openssh-server and can be installed through aptitude.
$ su -c 'apt-get install openssh-server'
You now should be able to SSH into your server with the following command:
$ ssh localhost
If you are greeted with a welcome message and a command prompt, you are successfully logged in, and your SSH server is ready for the next steps.
Wait! One thing I do recommend doing is forwarding external requests from port 443 to port 22 locally via your router firewall. This varies from router to router, but will allow you to tunnel into your dev machine during that long Amtrak commute, or really anywhere else that blocks all non-HTTP outbound traffic. Alternatively, have SSH start on port 443. If you host HTTPS services locally, you may enounter some difficulties with this approach.
Unless you somehow remember a 4096-bit passphrase (roughly 512 characters), your password is not as secure as a 4096-bit SSH key. Using a public key to log in to your server is preferred, so I will show you how to set one up!
First, we need to generate SSH keys. We will be running the following set of commands on your server, where you just installed SSH. We do this because we need ssh-keygen, as well as the ability to authorize our keys.
We'll generate RSA keys with a block size of 4096 (DSA limits us to 1024). Be sure to provide a strong passphrase on the off-chance your Chromebook gets hacked (cough HTML5 local storage). Accept the default key location for convenience.
$ ssh-keygen -t rsa -b 4096
This should place your public key in /home/<user>/.ssh/id_rsa.pub and your private key in /home/<user>/.ssh/id_rsa.
We need to authorize the key – just cat the .pub to your authorized_keys file:
$ cat /home/<user>/.ssh/id_rsa.pub >> /home/<user>/.ssh/authorized_keys
Now we can disable password authentication in your sshd_config file, restart the SSH server, and test our new key-based login:
$ su -c 'echo "PasswordAuthentication no" >> /etc/ssh/sshd_config'
$ su -c 'service sshd restart'
$ ssh localhost
If you get Permission denied (publickey), that means that you did not authorize your SSH key, or you entered the wrong SSH key password.
Finally, we get to turn on our beautiful Chromebook!
Please start by installing the Secure Shell extension by Google.
Open the extension, and fill in the username and the IP address for your server. If you don't know your server's IP address, chances are it's your home PC, and so open up a web browser on your desktop and navigate to WhatsMyIP.org.
Note: If your IP address changes now and then, try FreeDNS, No-IP, or ChangeIP.
You'll also need to fill in the SSH arguments field with the following values: -L 9000:localhost:9191 – doing this will create what is called a "local port forward", allowing us to access the remote port 9191 (on our server) via the Chromebook's local port 9000. This is a critical step!
Note: I also fill in port 443 for my SSH server – the default port is 22.
I recommend a USB stick for moving the private key to your Chromebook. We will need to copy our SSH key onto our Chromebook and import it as an identity in the SSH client.
When you've filled all of this in, hit Connect, and enter the password for your private key.
After successful login, we're going to want to restart our c9 server, this time with a few additional arguments.
$ cd /home/<user>/c9
$ node server.js -w/path/to/the/project/you/want/to/work/on -p 9191 --auth <username>:<password>
The -w flag tells our server to use the given path as the project root. There's a bug where if you type -w /path/to/project (note the space), then a blank folder is created in the c9 root directory. It is recommended to use -w with no space – this only applies to the -w flag.
The -p flag specifies the port number we want to listen on. The listen port 9191 has to match with our local port forward settings, or you won't be able to access your IDE.
The --auth <username>:<password> flag establishes a basic-auth security wall just in case. You can use any username and password you want here – it does not have to match any server-side or client-side information.
With our server running, minimize the SSH client, and navigate to http://localhost:9000 on your Chromebook.
Note: I did intentionally say 9000 in this URL – remember, local port 9000 forwards to our server's port 9191!
At this point, you should be able to do development by navigating to http://localhost:9000 and using the IDE.
If you're doing web development, you'll want to set up a SOCKSv5 proxy with the SSH arguments -D 8080 -C -N (-D is a dynamic forward, -C is for compression, -N means we don't need a command prompt). This will allow you to resolve domain names via your /etc/hosts file for Apache and NGINX.
You'll also want to install Proxy SwitchySharp, because the Chrome OS UI only allows for SOCKSv4 configuration which will not resolve DNS on the server (i.e., your /etc/hosts entries will be ignored).
I hope you enjoyed this article, please feel free to email feedback to chad{a.t}chadfurman{d.o.t}com.
Thanks go out to my friends and fellows at Clevertech for their help in making this article (and life in general) better than I could by myself. Special thanks to Jordan, Roger, Gábor, Andres, Nifty Lettuce, Lloyd, Michelle, and Kuty, who provided direct emotional support, edits, and suggestions.







Nice job, Chad, the article is super-clear and comprehensive.
I've taken the liberty of doing a proofreading pass on it, and you can see my changes here. Basically just correcting grammar, typos, and inconsistencies.
Beyond those, I would recommend to make three more changes, for a really professionally looking article:
For example,
# apt-get install openssh-serverwould mean to typeapt-get install openssh-serveras a privileged user.Let me know if I can help you with anything.