Table of Contents
1 Install ProFTPD
Install ProFTPD package.
> sudo zypper -n in proftpd
Enable upload by local user. Enable read by anonymous user. Disable upload by anonymous user.
> sudo sed -e ‘s/AuthOrder[[:space:]]*mod_auth_file.c/AuthOrder mod_auth_unix.c mod_auth_file.c/g’ -i /etc/proftpd/proftpd.conf
Open FTP port. Change NETWORK value to you network address (0/0 allows access from all IP address).
> cat <<EOF | sudo tee /etc/sysconfig/SuSEfirewall2.d/services/proftpd## Name: ProFTPD Server## Description: Opens ports for ProFTPD Server.TCP=”ftp 40000:40999″EOF> for t in FW_CONFIGURATIONS_EXT FW_CONFIGURATIONS_DMZ FW_CONFIGURATIONS_INT; do sudo sed -e “s/^${t}=”(.*)”/${t}=”1 proftpd”/g” -i /etc/sysconfig/SuSEfirewall2done> sudo sed -e ‘s/^FW_LOAD_MODULES=”(.*)”/FW_LOAD_MODULES=”1 ip_conntrack_ftp”/g’ -i /etc/sysconfig/SuSEfirewall2> sudo systemctl restart SuSEfirewall2
Enable and restart ProFTPD.
> sudo systemctl enable proftpd> sudo systemctl restart proftpd
Put file for anonymous user.
> echo “anon” | sudo tee /srv/ftp/anon.txt
2 Access to ProFTPD
Access to ProFTPD with lftp.
> sudo zypper -n in 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.comPassword:lftp [email protected]:~> pwdftp://[email protected]/%2Fhome/hiroom2lftp [email protected]:~> ls /drwxr-xr-x 2 0 0 4096 Jul 29 07:12 bindrwxr-xr-x 4 0 0 1024 Aug 05 12:16 bootdrwxrwxr-x 2 0 0 4096 Oct 09 2016 cdrom-rw——- 1 0 0 17711104 Jan 21 2017 coredrwxr-xr-x 21 0 0 4020 Aug 06 01:22 devdrwxr-xr-x 133 0 0 12288 Aug 06 01:22 etcdrwxr-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.comlftp ftp-server.hiroom2.com:~> pwdftp://ftp-server.hiroom2.comlftp ftp-server.hiroom2.com:~> ls /-rw-r–r– 1 0 0 5 Aug 06 01:22 anon.txt