Setting up Lukemftpd (Tnftpd)

tested on RHEL? / artful-bionic / slackware142

Requirements

RHEL

rpm -q gcc make byacc

Ubuntu

apt install build-essential byacc

Slackware

(you're good)

eventually get rid of the skeletons

mv -i /etc/skel/ /etc/skel.dist/
mkdir /etc/skel/

eventually create some user for authenticated sessions to work too

useradd -m storage
passwd storage

eventually create a guest account for anonymous usage

grep ^ftp: /etc/passwd
grep ^ftp /etc/group

#nbsd
useradd -d /tftpboot -k /dev/null -s /sbin/nologin ftp

#lignux
useradd -M -s /bin/false ftp

gives on netbsd

ftp:*************:1000:100::0:0::/tftpboot:/sbin/nologin

gives on debian/ubuntu

ftp:x:UID-HERE:GID-HERE::/home/ftp:/bin/false

gives on slackware

ftp:x:14:50::/home/ftp:/bin/false

and eventually change ftp user’s home directory to something useful – be it a directory listing or some PXE repository

vipw

#slackware PXE server
ftp:x:14:50::/tftpboot:/bin/false

NO NEED TO GIVE A SHELL for the anonymous ftp user! The guest account works even so.

Install

Check for latest tarball and

wget ftp://ftp.netbsd.org/pub/NetBSD/misc/tnftp/tnftpd-20190602.tar.gz
wget ftp://ftp.netbsd.org/pub/NetBSD/misc/tnftp/tnftpd-20190602.tar.gz.asc
tar xzf tnftpd-20190602.tar.gz
cd tnftpd-20190602/
./configure --help | less
./configure --without-pam
#--with-blacklist
make -j4
make install

Setup

handy symlinks

cd ~/

#nbsd
cp /usr/share/examples/ftpd/ftpd.conf /etc/ftpd.conf.dist
mv /etc/ftpchroot /etc/ftpchroot.dist
mv /etc/ftpusers /etc/ftpusers.dist
ln -s /etc/ftpchroot
ln -s /etc/ftpd.conf
ln -s /etc/ftpusers

ln -s /usr/local/etc/ftpchroot
ln -s /usr/local/etc/ftpd.conf
ln -s /usr/local/etc/ftpusers

vi /etc/ftpd.conf #newfile
vi /usr/local/etc/ftpd.conf #newfile

motd all none
umask chroot 022
umask real 022

#firewall
#portrange all 70000 70999

#NAT
#advertize all FRONT-FACING-IP

vi /etc/ftpusers #newfile
vi /usr/local/etc/ftpusers #newfile

storage     allow chroot
ftp     allow guest
anonymous   allow guest
*       deny

Anonymous upload directory (optional)

mkdir /tftpboot/incoming/
chmod 777 /tftpboot/incoming/
chmod +t /tftpboot/incoming/

on netbsd you get

----rw----  1 ftp  wheel  3 Apr 14 11:31 ok

on slackware you get

----rw----  1 ftp  ftp      3 Apr  1 10:31 ok

trying to retrieve

get: Access failed: 550 ok: Permission denied.

trying to override

put: Access failed: 553 ok: Permission denied.

and you may add some check in the daily cron job

vi /etc/daily

    echo content of /tftpboot/incoming/:
    find /tftpboot/incoming/
    echo

Fortunes (optional)

Ubuntu

apt search fortune
apt install fortune fortunes
/usr/games/fortune -n 40 -s | head -1

Slackware

/usr/games/fortune -s | head -1

and use it below as -V

Ready to go

NetBSD

echo ftpd=yes ftpd_flags="-ll -V ''" >> /etc/rc.conf
/etc/rc.d/ftpd start

ps auxww | grep ftpd

GNU/Linux

vi /etc/rc.local

echo -n starting lukemftpd...
/usr/local/libexec/tnftpd -D -4 -ll -V "" && echo done || echo FAILED

ps auxfww | grep ftpd

Acceptance

telnet localhost 21
quit

ftp -a localhost

HOME | GUIDES | BENCHMARKS | html