Unix Tips

Some neat unix tips and tools that may be helpful.

SSH

SSH as a SOCKS Proxy

In addition to forwarding a TCP port through its encrypted connection, openssh also has the cool feature of acting as a SOCKS proxy. This is as easy as `ssh -D 8080 remote.host.edu'. If you use firefox, the FoxyProxy extension plays nicely with this feature, letting you set up site-specific proxy rules.

Slow SSH Logins

OpenSSHd by default does a reverse DNS lookup on clients before allowing them to connect. This can take several seconds to complete, and is often annoying. If you have control over the server, you may disable this lookup by adding the line UseDNS no to /etc/ssh/sshd_confg.

socat

Like netcat, only better. Will pipe all manner of file, TCP, UDP, exec'ed, and SOCKS-proxied streams.

Linux on Flash Media

tmpfs

When installing linux on flash media, it is probably desirable to minimize the number of writes in order to extend the life of the media. There are two easy steps to help with this.

First, mount all filesystems with the "noatime" option. This will prevent updates to the access time field every time a file is accessed. This will greatly reduce the number of writes, and also improve system performance (it's often a good idea even on magnetic media).

Second, put heavily written directories on tmpfs, which is a variable size ramdisk available in linux. The best candidate for this is /tmp. Another option, if you're not heavily concerned about system logs, is to put /var/log on tmpfs.