Skip to content

SOCKS5 proxy for accessing UCL SWC internal web

Jeffrey Erlich edited this page Jul 12, 2024 · 3 revisions

Using a SOCKS proxy instead of VPN

The SWC provides a VPN for access to SWC resources when working at home.

One can directly ssh to ssh.swc.ucl.ac.uk on the terminal to get access to HPC without VPN, but if you want access to web pages (e.g. getting articles from Cell) or UCL MyHR, then an alternative to the VPN is to use a SOCKS proxy

One bonus of using a SOCKS proxy is that you can run two browsers (e.g. firefox and chrome) and use extensions (e.g. Foxy Proxy) to set a proxy per browser. So you can have firefox traffic routed through SWC and chrome traffic routed through your normal ISP.

Setting up ssh keys

  1. Open a terminal. Follow the commands below, replacing swcuser with your own username.

~ 
❯ cd .ssh

~/.ssh
❯ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/jerlich/.ssh/id_rsa): swc
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in swc
Your public key has been saved in swc.pub
The key fingerprint is:
SHA256:asdafdsdfasdfasj/6ESasdfadLkmxN6NRiS9m3KzqlGnU jerlich@foo
The key's randomart image is:
+---[RSA 3072]----+
+----[SHA256]-----+

~/.ssh took 3s
❯ ssh-copy-id -i swc swcuser@ssh.swc.ucl.ac.uk
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "swc.pub"
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
swcuser@ssh.swc.ucl.ac.uk's password:

Number of key(s) added:        1

Now try logging into the machine, with: "ssh 'swcuser@ssh.swc.ucl.ac.uk'" and check to make sure that only the key(s) you wanted were added.

Now edit ~/.ssh.config to add this:

Host swc
    HostName ssh.swc.ucl.ac.uk
    User swcuser
    IdentityFile ~/.ssh/swc

Now in the terminal if you type ssh swc you should be able to login with no password. If it doesn't work check the permissions on your .ssh folder:

chmod 700 ~/.ssh
chmod 600 ~/.ssh/*

NOTE: if you haven't logged in for a while it will ask you for your password, but then it will use the key the next time.

Clone this wiki locally