Fedora 29: Install ProFTPD for FTP server

This article will describe installing ProFTPD for FTP server.

1 Install ProFTPD

Install ProFTPD package.

$ sudo dnf install -y proftpd proftpd-utils

Enable upload by local user. Enable read by anonymous user. Disable upload by anonymous user.

$ sudo sed \
-e 's;PROFTPD_OPTIONS="\(.*\)";PROFTPD_OPTIONS="-DANONYMOUS_FTP \1";g' \
-i /etc/sysconfig/proftpd

Open FTP port.

$ sudo firewall-cmd --add-service=ftp --permanent
$ sudo firewall-cmd --reload

Enable and restart ProFTPD.

$ sudo systemctl enable proftpd
$ sudo systemctl restart proftpd

Put file for anonymous user.

$ echo "anon" | sudo tee /var/ftp/anon.txt

1.1 Add /sbin/nologin to /etc/shells for anonymous user login

There is a /sbin/nogin in /etc/shells on previous version Fedora but current version Fedora not.

This will prevent anonymous user login. ProFTPD will output the following log to journald.

proftpd USER ftp (Login failed): Invalid shell: '/sbin/nologin'

Add /sbin/nologin to /etc/shells for anonymous user login.

$ if ! grep "/sbin/nologin" /etc/shells > /dev/null; then
  echo "/sbin/nologin" | sudo tee -a /etc/shells
fi

2 Access to ProFTPD

Access to ProFTPD with lftp.

$ sudo dnf install -y lftp

Access to ProFTPD with specifying user. You can specify password with -u <username>,<password>. Home directory is displayed. You can access directory and files of FTP server with using user permission.

$ lftp -u hiroom2 ftp-server.hiroom2.com
Password:
lftp hiroom2@ftp-server.hiroom2.com:~> pwd
ftp://hiroom2@ftp-server.hiroom2.com/%2Fhome/hiroom2
lftp hiroom2@ftp-server.hiroom2.com:~> ls /
drwxr-xr-x    2 0        0            4096 Jul 29 07:12 bin
drwxr-xr-x    4 0        0            1024 Aug 05 12:16 boot
drwxrwxr-x    2 0        0            4096 Oct 09  2016 cdrom
-rw-------    1 0        0        17711104 Jan 21  2017 core
drwxr-xr-x   21 0        0            4020 Aug 06 01:22 dev
drwxr-xr-x  133 0        0           12288 Aug 06 01:22 etc
drwxr-xr-x    4 0        0            4096 Aug 06 01:22 home
<snip>

Not specifying user uses anonymous user. The directory which is set to anon_root is displayed. Anonymous user cannot access upper directory because ProFTPD uses chroot.

$ lftp ftp-server.hiroom2.com
lftp ftp-server.hiroom2.com:~> pwd
ftp://ftp-server.hiroom2.com
lftp ftp-server.hiroom2.com:~> ls /
-rw-r--r--    1 0        0               5 Aug 06 01:22 anon.txt