just some stuff

using sshfs inside a linux vserver

13 Feb 2011

today i tried to remember how i allowed a user to use sshfs from within a linux vserver. so just to remember, here is how i did it.

sshfs is a cool too to remotely mount storage devices. fuse is also part of glusterfs, so if you plan to use this within a vserver, you need to do the same preparing work:

1. enabling fuse in the host

if you havent done it yet, you need to load the fuse kernel module in the host:

modprobe fuse


then copy the /dev/fuse device file into the vserver vdir

cp -a /dev/fuse /etc/vservers/<myserver>/vdir/dev


2. making /dev/fuse usable from within the vserver



now you need to fix permissions inside the vserver:

vserver <myserver> enter
groupadd -g 102 fuse
chmod g+rw /dev/fuse
chgrp fuse /dev/fuse


still, fusermount will fail because the vserver has no permissions yet to perform any mount:

/etc/vservers/<myserver>/ccapabilities
SECURE_MOUNT
SECURE_REMOUNT
BINARY_MOUNT 

/etc/vservers/<myserver>/bcapabilities SYS_ADMIN


this should do the trick.

3. testing the setup



now restart the vserver, enter the virtual server again and sshfs should work.

sshfs -o sshfs_sync storage@<targetserver>:/remote/path /my/mountpoint