Unix/Linux Systems

SSH

The Secure SHell is a utility used to connect to a remote computers.

Example:

$ ssh user@host.mines-paristech.fr

To simplify connections to machines used on a daily basis a configuration file ~/.ssh/config can be created.

Example:

ServerAliveInterval 120
ServerAliveCountMax 5

Host            ssh-sop
Hostname        ssh-sop.mines-paristech.fr
User            alarcher

Host            mast-in
Hostname        mast-in-cluster.cemef.mines-paristech.fr
User            aurelien.larcher
ProxyJump       ssh-sop

Host            git
Hostname        git.sophia.mines-paristech.fr
User            git
ProxyJump       ssh-sop

Host            cluster
Hostname        front-in1-cluster.cemef.mines-paristech.fr
User            aurelien.larcher
ProxyJump       ssh-sop

For instance your should at least have an entry like below for your own workstation:

Host            my_machine
Hostname        my_machine.interne.mines-paristech.fr
User            my_username
ProxyJump       ssh-sop

Comment out the ProxyJump lines if your computer is located on the mines-paristech.fr network.

Browse with Chromium using a SOCKS proxy

Add the following line to your .bashrc:

alias chrome-cemef='( curl -sSf --socks5-hostname localhost:1337 www.google.com > /dev/null || ssh -Nf -D 1337 my_machine ) && chromium --proxy-server="socks5://localhost:1337" --host-resolver-rules="MAP * ~NOTFOUND , EXCLUDE localhost"'

where my_machine should be replaced by the Host entry in the SSH configuration file above.

Alternatively copy the following shell script:

#!/bin/bash

WORKSTATION=my_machine

( curl -sSf --socks5-hostname localhost:1337 www.google.com > /dev/null || \
    ssh -Nf -D 1337 ${WORKSTATION} ) \
&& \
chromium --proxy-server="socks5://localhost:1337" \
    --host-resolver-rules="MAP * ~NOTFOUND , EXCLUDE localhost"