SSH Tunneling is a great way to keep your data safe and secure when using Chrome OS. You can use SSH Tunneling to connect to a remote server through an SSH connection, and then access the remote server’s files and folders without having to enter your login information each time. This can be helpful if you need to access sensitive data on a remote server, or if you want to keep your Chromebook safe from potential cyber-attacks. To set up SSH Tunneling on Chrome OS, first open the Chrome browser and navigate to the chrome://flags/#enable-ssh-tunneling page. Once you’ve found this page, click on the “Enable” button next to “SSH Tunneling.” Once you’ve enabled SSH Tunneling, you’ll need to create a new tunnel. To do this, open the Terminal app and type: ssh -L 10.0.0.1:80 -R 10.0.0.2:443 my_server
Chromebooks offer built-in support for SSH tunnelling with their included crosh shell and SSH command. An SSH tunnel allows you to use an SSH connection like a VPN or encrypted proxy, sending your browsing traffic through the secure tunnel.
This allows you to encrypt traffic when browsing on a public network, access geo-blocked content, or even tunnel your way around Internet censorship like the Great Firewall of China.
Step 1: Open the SSH Tunnel
RELATED: 10+ Commands Included In Chrome OS’s Hidden Crosh Shell
When setting up SSH tunnelling on any operating system, there are two steps. First, you’ll need to establish a connection to the SSH server and open a tunnel.
To do this, open the crosh shell by pressing Ctrl+Alt+T anywhere in Chrome OS. The shell will open in a browser tab.
Next, use the appropriate ssh command to connect to an SSH server and establish a tunnel. You’ll do this by running the ssh command and then by typing every option on its own line, like so:
After you run the connect command, you’ll be prompted to enter the password to authenticate with the server or to unlock your key file.
host [SSH server IP address or hostname] (Enter the remote SSH server’s IP address or hostname here.)
user [username] (Enter your username on the remote SSH server here.)
port [port number] (Enter the port number teh SSH server is listening on. If it’s the default port 22, you don’t need this line.)
dynamic-forward [port number] (Enter a local port number for the ssh forwarding — for example, dynamic-forward 8800.)
key [key file name] (Enter a key file name if you need a key to connect to the SSH server and not just a password. Omit this line if the SSH server doesn’t require a key.)
connect
You may also use Google’s official Secure Shell app for this. Launch the extension and enter the SSH server’s details in the sign-in window. In the arguments box, enter -D 8800 or another port number of your choice.
Step 2: Have Chrome OS Use the Tunnel
RELATED: 5 Cool Things You Can Do With an SSH Server
The tunnel is now open, but your Chromebook won’t automatically use it.You’ll need to specify the tunnel as a proxy in Chrome, which will cause Chrome to send its traffic through the tunnel.
There are some problems here, as Chrome OS won’t normally send DNS requests over the tunnel (see bug 29914) . This is because Chrome OS uses the SOCKS4 protocol for the tunnel by default, even though it supports the more secure SOCKS5 protocol. There’s no option to choose SOCKS5 when setting up a proxy in Chrome OS’s user interface (see bug 199603).
If you don’t care that your DNS requests are sent out across your current connection, you can just enable the proxy the normal way. To do so, open your Chromebook’s Settings page and check the “Allow proxies for shared networks” option under Internet connection. Next, click the name of your Internet connection, click over to the Proxy tab, and select “Manual proxy configuration.” To the right of SOCKS host, enter “localhost” and the port you specified earlier.
To configure a SOCKS5 proxy the easy way, use the Proxy SwitchySharp extension. It allows you to enter the appropriate details and select SOCKS5, using the Chrome proxy API to change your proxy settings so Chrome will use a SOCKS5 proxy.
Use the SwitchSharp Options page to create a new proxy profile and name it something like “SSH Tunnel.” Under Manual Configuration and to the right of SOCKS Host, enter “localhost” as the address and enter the port number you chose earlier. Choose the “SOCKS v5” option. When you use this proxy profile, it will forward your traffic over the SSH tunnel.
If you’d rather not use a browser extension, you can instead create your own proxy auto-configuration (PAC) file and point Chrome at it. To do this, simply use a text editor (Caret is a good offline text editor for Chrome OS) and enter the following text into it:
Of course, you should enter the port you chose earlier if you didn’t choose 8800. Save the text file with the .pac file extension — for example, you could just save it in your Downloads folder.
You can now re-visit the proxy configuration screen and choose “Automatic Proxy Configuration.” Enter the path to the .pac file, either stored on your Chromebook yourself or on a remote server. For example, the path to access your downloads folder on Chrome OS is file:///home/chronos/user/Downloads/. So, since we saved our file with the name ssh_tunnel.pac, we’d enter file:///home/chronos/user/Downloads/ssh_tunnel.pac here.
If you start seeing connection errors while using the proxy configuration, it may be because your SSH connection was closed. You’ll need to re-connect to the SSH server in the same way or un-set the proxy options, allowing your Chromebook to connect to the Internet directly again.
Image Credit: sigckgc on Flickr