Table of Contents
VHFFS File System
Prerequisites
- Debian packets
apt-get install fuse-utils libfuse-dev libglib2.0-dev libpq-dev
- Kernel
If you are compiling your own kernels, you need to compile the Fuse module to use VHFFS-FS
CONFIG_FUSE_FS=m
VHFFS-FS compilation
cd [sources]/vhffs-fs/ ./configure --prefix=/usr make clean make make install
Configuration
cp /etc/vhffs/vhffsfs.conf.dist /etc/vhffs/vhffsfs.conf
Edit the /etc/vhffs/vhffs.conf
file
</global> [...] # Whether to use vhffsfs or not. vhffsfs allows you to provide a # virtual home directory depending on the uid of the running process # in order to avoid using of a virtual chroot to provide ftp, sftp, or a shell use_vhffsfs = yes </global>
Edit the /etc/vhffs/vhffsfs.conf
file
Create this folder:
mkdir /home/hosted
Add into /etc/fstab
vhffsfs /home/hosted fuse defaults,allow_other,hard_remove,readdir_ino,use_ino,noauto_cache,entry_timeout=0,negative_timeout=0,attr_timeout=0,ac_attr_timeout=0,intr 0 0
FTP configuration
Change the /etc/pure-ftpd/db/postgresql.conf
file:
Replace
PGSQLGetDir SELECT u.homedir FROM vhffs_users u INNER JOIN vhffs_object o ON o.object_id=u.object_id WHERE u.username='\L' AND o.state=6
by
PGSQLGetDir SELECT '/home/hosted' AS homedir
NSS configuration to provide SSH service
- nss-pgsql:
Replace
getpwnam = SELECT p.username, '*' AS passwd, p.username, p.homedir, p.shell, p.uid, p.gid FROM vhffs_passwd p WHERE p.username = $1 getpwuid = SELECT p.username, '*' AS passwd, p.username, p.homedir, p.shell, p.uid, p.gid FROM vhffs_passwd p WHERE p.uid = $1 allusers = SELECT p.username, '*' AS passwd, p.username, p.homedir, p.shell, p.uid, p.gid FROM vhffs_passwd p
by
getpwnam = SELECT p.username, '*' AS passwd, p.username, '/home/hosted' AS homedir, p.shell, p.uid, p.gid FROM vhffs_passwd p WHERE p.username = $1 getpwuid = SELECT p.username, '*' AS passwd, p.username, '/home/hosted' AS homedir, p.shell, p.uid, p.gid FROM vhffs_passwd p WHERE p.uid = $1 allusers = SELECT p.username, '*' AS passwd, p.username, '/home/hosted' AS homedir, p.shell, p.uid, p.gid FROM vhffs_passwd p
- nss-sqlite: change the cron:
nss-mirror.pl --force-homedir=/home/hosted