Socks proxy with auto-config

OpenSSH has built-in support to act as a SOCKS proxy. In my case, there are web sites I can access only from work computers and I need to get to them from home. So, I issue the command from my home computer:

ssh -D 1080 my work IP

However, I do not want to redirect all traffic through work.  Fortunately, you can redirect only selected URLs fairly easily by using a proxy auto-config file.

In firefox, Go to Edit -> Preferences -> Advanced -> Network -> Settings

In the Connection Settings box, select “Automatic proxy configuration URL:” and enter:
file:///path/to/proxylist.pac
The proxylist.pac file may look like this:

function FindProxyForURL(url, host)
{
// Proxy direct connections to these hosts
if (
shExpMatch(url, "http://www.jbc.com/*") ||
shExpMatch(url, "*.sgmjournals.org/*") ||
shExpMatch(url, "http://www.ncbi.nih.gov/*")
) {
return "SOCKS localhost:1080; DIRECT";
}
// Otherwise go directly
else return "DIRECT";
}

For more details on the pac file and auto config, see
http://en.wikipedia.org/wiki/Proxy_auto-config

sshfs – Remote filesystem access made easy

If you often need to access files on a remote machine and do it by ssh login, there is a handy way – sshfs. Here is a simplified howto that works.

(1) Set up the rpmforge repository if not done yet (see Installing RPMForge )
(2) Either use the dkms-fuse with the stock RHEL/CentOS kernel or use the centosplus kernel that contains the fuse kernel module.

[Note 1: fuse is included in the kernel as of RHEL/CentOS/SL 5.4]
[Note 2: In RHEL/CentOS/SL 6, start with step (4)]

[root@mybox ~]# yum install dkms-fuse && modprobe fuse

(3) Also install the fuse libraries:

[root@mybox ~]# yum install fuse

(4) Then install the fuse-ssh filesystem:

[root@mybox ~]# yum install fuse-sshfs

(5) Add yourself to the group ‘fuse’:

[root@mybox ~]# usermod -a -G fuse user1

(6) Re-logon to your account
(7) Create a local directory:

[user1@mybox ~]$ mkdir remotedir/

(8) To mount (remote username=usr2):

[user1@mybox ~]$ sshfs user2@machine.example.com: remotedir/

(9) To unmount:

[user1@mybox ~]$ fusermount -u remotedir