Alright, I spun up a VirtualBox guest to try this out with:
- 8GB VDI, 512MB RAM
- Install from ubuntu-12.04-desktop-i386.iso
- /dev/sda1, 7000MB, ext4, mount /
- /dev/sda5, 999MB, fat32, mount /media/Store (NTFS wasn't an option in the installer)
- /dev/sda6, 587MB, swap
- All other settings default except for time zone.
Ack, I'd forgotten how awful Unity was. :) I added Virtual Guest Additions, ran update-manager, waited for... 618 updates, reboot. Then I followed the Community documentation at:
https://help.ubuntu.com/community/PureFTP
sudo apt-get install pure-ftpd
# already installed?
gksudo gedit /etc/inetd.conf
# no changes required?
gksudo gedit /etc/default/pure-ftpd-common
# already: STANDALONE_OR_INETD=standalone
# changed: VIRTUALCHROOT=true
sudo groupadd ftpgroup
sudo useradd -g ftpgroup -d /dev/null -s /etc ftpuser
NOTE: id ftpuser returns uid=1001(ftpuser) gid=1001(ftpgroup) groups=1001(ftpgroup) at this point.
sudo mkdir /home/ftpusers
sudo mkdir /home/ftpusers/joe
sudo pure-pw useradd joe -u ftpuser -d /home/ftpusers/joe
sudo pure-pw mkdb
sudo ln -s /etc/pure-ftpd/pureftpd.passwd /etc/pureftpd.passwd
sudo ln -s /etc/pure-ftpd/pureftpd.pdb /etc/pureftpd.pdb
sudo ln -s /etc/pure-ftpd/conf/PureDB /etc/pure-ftpd/auth/PureDB
sudo sh -c 'echo "no" > /etc/pure-ftpd/conf/UnixAuthentication'
sudo chown ftpuser:ftpgroup -R /home/ftpusers
gksudo pureadmin
Confirmed that /etc/pure-ftpd/pureftpd.passwd contained:
joe:...:1001:1001::/home/ftpusers/joe/./::::::::::::
sudo /etc/init.d/pure-ftpd restart
# Restarting ftp server: Running: /usr/sbin/pure-ftpd-virtualchroot -l pam -l puredb:/etc/pure-ftpd/pureftpd.pdb -E -8 UTF-8 -O clf:/var/log/pure-ftpd/transfer.log -u 1000 -B
Now I was able to ftp localhost as joe.
First attempt: I created a symlink to /media/Store, which joe could see in his ls /, but could not cd in to (550 Can't change directory to Store: Permission denied):
sudo ln -s /media/Store /home/ftpusers/joe/Store
sudo chown ftpuser:ftpgroup -R /home/ftpusers/joe
# sudo rm /home/ftpusers/joe/Store
Second attempt: I created a symlink to /dev/sda5, which joe could see in his ls /, but could not cd in to (550 Can't change directory to Store: Not a directory):
sudo ln -s /dev/sda5 /home/ftpusers/joe/Store
sudo chown ftpuser:ftpgroup -R /home/ftpusers/joe
# sudo rm /home/ftpusers/joe/Store
This wasn't surpising, since /dev/sda5 is a block store not a file system, but I tried it for giggles.
Third attempt: Being the alternative that I gave in my first answer, worked:
sudo mkdir /home/ftpusers/joe/Store
sudo chown ftpuser:ftpgroup -R /home/ftpusers/joe
sudo mount -t vfat -o noexec,ro,uid=1001,gid=1001 /dev/sda5 /home/ftpusers/joe/Store
NOTE: I had to sudo umount /media/Store before I could mount it at /home/ftpusers/joe/Store.
To be doubly sure that this also works with NTFS, I sudo umount /home/ftpusers/joe/Store, I ran Disk Utility, reformatted the partition as NTFS, mounted the volume (which opens it in Nautilus), added a HelloNtfsWorld.txt file, unmounted it in Disk Utility, then the above test with the slightly modified mount command:
sudo mount -t ntfs -o noexec,ro,uid=1001,gid=1001 /dev/sda5 /home/ftpusers/joe/Store
Perfect!
ftp> ls -la
200 PORT command successful
150 Connecting to port 53727
drwxr-xr-x 3 1001 ftpgroup 4096 Sep 15 22:12 .
drwxr-xr-x 3 1001 ftpgroup 4096 Sep 15 22:12 ..
drwxrwxrwx 1 1001 ftpgroup 4096 Sep 15 22:36 Store
226-Options: -a -l
226 3 matches total
ftp> cd Store
250 OK. Current directory is /Store
ftp> ls -la
200 PORT command successful
150 Connecting to port 57505
drwxrwxrwx 1 1001 ftpgroup 4096 Sep 15 22:36 .
drwxr-xr-x 3 1001 ftpgroup 4096 Sep 15 22:12 ..
-rwxrwxrwx 1 1001 ftpgroup 0 Sep 15 22:36 HelloNtfsWorld.txt
226-Options: -a -l
226 3 matches total
ftp>
Hope this helps!