The officially official Devuan Forum!

You are not logged in.

#1 2021-10-13 20:52:39

kaiyel
Member
Registered: 2019-10-16
Posts: 24  

HOWTO : enable pure-ftpd to follow symbolic links

One of pure-ftpd's key FTP server features is the ability to chroot individuals to their home folders, while still allowing the admin to use symbolic links to delegate disk space to these individuals.

From https://www.pureftpd.org/project/pure-ftpd/ :

Symbolic links can be followed when users are chrooted, even when they are pointing out of the chroot jail. This unique feature makes shared content easy to set up.

However, this feature requires that the binary has been compiled with the --with-virtualchroot switch set.  Failure to do so will result in ftp clients experiencing errors like "550 Can't change directory to thefoldername: No such file or directory" when attempting to navigate symbolic link folders.

Unfortunately for me, who uses this feature in-house (each dev group has their own "project" share), office (the scanner uploads to a samba accessible folder), and production (customers each have their own "site" share), the Devuan/Debian package has not set this flag.

What follows are the steps I used to restore that feature capability to the Devuan pure-ftpd package.  Rebuilding .deb packages is old-hat for the Debian folks, so read no further.  But if you (like me) are escaping the RedHat/systemd fork-that-was-not-a-fork, and are much more acquainted with RPM than APT, maybe this helps.

echo "start with an updated system"
apt-get update
apt-get upgrade

echo "you will need the devscripts tools"
apt-get install devscripts

echo "work within a folder apt can access"
cd /tmp/

echo "acquire the pure-ftp source and build dependencies"
apt-get source pure-ftpd
apt-get build-dep pure-ftpd

echo "set the virtualchroot flag"
cd pure-ftpd-1.0.47/
vi debian/rules
-- optflags=--with-everything --with-largefile --with-pam --with-privsep --with-tls --with-rfc2640
++ optflags=--with-everything --with-largefile --with-pam --with-privsep --with-tls --with-rfc2640 --with-virtualchroot

echo "supply a changelog comment and bump the revision number"
dch -n

echo "rebuild and install the package(s)"
debuild -us -uc
cd ..
apt-get install ./pure-ftpd_1.0.47-3.1_amd64.deb ./pure-ftpd-common_1.0.47-3.1_all.deb

echo "done"
cd

Hope I have that right ... feedback is welcome.  There was a bit of trial and error failure getting there as this was my first ever .deb package rebuild.

--K

Offline

Board footer