Install SSHFs in Openvz container



  • Download appropriate kernel from or compile kernel with CONFIG_FUSE_FS option set
  • Debian/Ubuntu: You can alternatively add the line fuse into /etc/modules, and apply immediately with the command:
    modprobe --first-time fuse


You have to fuse libraries and some fuse filesystem modules (here we use sshfs as an example).

The best way to have it installed is to use the packages from your distro vendor. An alternative is compiling the stuff from source.


# emerge sys-fs/sshfs-fuse


# yum install fuse-sshfs


Debian 5.0 (lenny)[edit]

FUSE cannot be installed due to udev/hotplug dependency (explained in bug report 503953)

Ubuntu, Debian 6.0 (squeeze), Debian 4.0 (etch) and older[edit]
# apt-get install sshfs

(Debian 4.0 note: see Installing udev in VE based on Debian-4.0)

Compiling from source[edit]

If there are no packages provided for you distribution, you have to compile from source.

First, compile libfuse in a container without kernel module

# vzctl enter 100
# tar xzf fuse-2.6.0.tar.gz
# cd fuse-2.6.0
# ./configure --disable-kernel-module
# make
# make install

Yellowpin.svg Note: Sometimes is unseen by your programs. Usually this file is installed in /usr/local/lib directory so don’t forget to add this directory into your /etc/ and then run ldconfig.

Next, download and compile filesystem.

# vzctl enter 100
# tar xzf sshfs-fuse-1.7.tar.gz
# cd sshfs-fuse-1.7
# ./configure
# make
# make install

Container tuning[edit]

You need to make a character device named /dev/fuse and grant your container permissions to it

# vzctl set 100 --devices c:10:229:rw --save
# vzctl exec 100 mknod /dev/fuse c 10 229

Or more simply:

# vzctl set 103 --devnodes fuse:rw --save
... Once you add above setting restart the container (without restart SShfs will not work)

Mounting filesystem[edit]

After this you may try to mount FUSE in a container.

# vzctl enter 100
# sshfs /mnt/

Unmounting filesystem[edit]

In case of sshfs after umounting an appropriate daemon must be killed. This may be done by the following command:

# fusermount -u mountpoint

Using fusectl filesystem[edit]

Fusectl is a helper filesystem for FUSE. You may mount it in a container as well.

# vzctl enter 100
# mount -t fusectl none /fuse_ctl


Categories: linux, Ssh

Comments are closed.