Today we will see how to mount remote directory via SSHFS on FreeBSD operating system. Recently I found online storage which offers access via SSHFS and where you can have free 1G of space. Let's see how to link this account to FreeBSD.

Let's assume we have FreeBSD 8.2 without any packages and sources. Let's prepare our system (download ports, install utilities):

# portsnap fetch extract
# cd /usr/ports/ports-mgmt/portmaster/ && make install clean

FUSE is used for mounting SSHFS in our system. To build FUSE we need source codes from here sysinstall -> configure -> distributions -> src -> all. Now let's build binaries for working with SSHFS:

# portmaster sysutils/fusefs-sshfs

Tune it little bit. Let's enable user to be able to mount our filesystem:

# sysctl vfs.usermount=1

For permanent effect one should edit /etc/sysctl.conf by adding vfs.usermount=1. Also we need to change rights on FUSE device like that:

# devfs ruleset 10
# devfs rule add path 'fuse*' mode 666

Now let's create folder where we will mount our remote filesystem and let's link it:

$ mkdir /home/kavolorn/sshfs
$ sshfs -o uid=1003 -o gid=1003 -o allow_other 
  kavolorn@kavolorn.strongspace.com:/strongspace/kavolorn/home 
  /home/kavolorn/sshfs/

Strongspace will ask for your passwords and after that you will have sshfs connected. That's all. You can also use public key for authenticating. You can generate it like that:

$ ssh-keygen

Automatic mount let's leave for hometask :)

Links

http://strongspace.com/
http://ru.wikipedia.org/wiki/SSHFS
http://ru.wikipedia.org/wiki/Filesystem_in_Userspace
http://fuse.sourceforge.net/