Get in touch:
01524 851 877
07718 896 553

SSHFS – Mounting Remote Directories Over SSH

Posted on Jun 20 2008

For a while now I have been wondering how easy it is to mount a remote directory. I have always known there must be a way to do it but had never actually got around to looking it up. It was only the other day when someone showed me SftpDrive, an application for windows that allows you to mount remote directories over SFTP.

This got me searching around for a similar method for Linux. I just wanted to be able to mount a directory on a remote machine and be able to access it as though it was a directory on my local machine. My searching led me to SSHFS.

SSHFS allowed me to do exactly what i want. A simple ‘apt-get’ in Ubuntu installed it and I was ready to go. You need to add yourself to the fuse group after it has been installed (adduser fuse) and then restart your terminal. (You may also need to ‘modprobe fuse’)

Once this is done you are ready to go, simply mount a remote directory using a command like ‘sshfs username@hostnema:/remote/path/ /local/path’

Make sure you have made a directory somewhere on your local machine to be the mount point and chown’d it using ‘sudo chown your-username /local/path’.

All being well you should now have your remote directory mounted as if it was on your own machine. I have found this extremely useful for working on a few web based projects. Another thing that it is very useful for is running backups of my remote servers. A simple cron job running a script to backup your remote servers works a treat.

Linux and TCP Congestion Control

Posted on Jun 12 2008

I saw a question on the Ubuntu forums this morning from someone who has recently started using a satellite connection and was getting poor performance loading web pages, which is to be expected really with the high Bandwidth Delay Product (BDP) of satellite links.

The question was asking if there are any ways to tune TCP in Linux to perform better over this type of connection. There are obviously various TCP congestion control algorithms knocking about, cubic, reno, vegas, hybla etc but up until now I thought you had to recompile the kernel in order to change the algorithm being used. I was wrong.

It appears that since Linux kernel version 2.6.13 a new feature, pluggable congestion avoidance modules, has been supported. This enables the changing of the algorithm being used by simply issuing a sysctl command.

The available algorithms have to be configured when the kernel is compiled but once they have been set up they can be easily changed in a running kernel. In order to see what algorithms are already in your running kernel you can issue the command :

sysctl net.ipv4.tcp_available_congestion_control

If the algorithm you wish to use is not already in your running kernel you can find a list of them and compile them in in the following place using make menuconfig/xconfig :

Networking --->
Networking options --->
TCP: advanced congestion control --->
TCP congestion control --->

Once you have all the algorithms you want in your running kernel it is a simple matter to switch between them, for example to change to using the hybla algorithm (ideal for satellite links as it tries to keep the window size as large as possible on high BDP links) you just issue the following command (as root):

sysctl -w net.ipv4.tcp_congestion_control=hybla

This is a nifty little addition to the Linux kernel that could prove very useful, especially for people with mobile devices that constantly use networks with varying characteristics.

Conditional Statements Explained

Posted on Jun 11 2008

I have often used #if, #ifdef, #if defined() etc as conditional preprocessor directives but haven’t really thought in depth about the differences between them. It was only when someone asked the question in a C channel on freenode that it made me think.

A quick search of google brought me across a nice little explanation. Rather than recycling the information here is the link :

Conditional Compilation (#if, #ifdef, ..#endif)

Quite an interesting little read.