Monday, January 1, 2018
HowTo Setup an Anonymous FTP server on FreeBSD
HowTo Setup an Anonymous FTP server on FreeBSD
To test the speed differences between SFTP and FTP I decided to setup an anonymous FTP server on my trusted old 266 Mhz Celeron running FreeBSD 7.0.
The File Transfer Protocol (FTP) provides a simple and classic method for transferring files from one computer to another across the internet.
FreeBSD base install includes FTP server software, namely ftpd.
Im fully aware of the security implications regarding FTPs transmission of usernames and passwords in clear text hence the choice of an anonymous FTP server in real-only mode.
Lets start by creating a ftp user:
- % su
- # adduser
Username: ftp
Full name: Anonymous FTP user
Uid (Leave empty for default):
Login group [ftp]:
Login group is ftp. Invite ftp into other groups? []:
Login class [default]:
Shell (sh csh tcsh bash rbash zsh nologin) [sh]: nologin
Home directory [/home/ftp]: /var/ftp
Use password-based authentication? [yes]: no
Lock out the account after creation? [no]: no
Username : ftp
Password :
Full Name : Anonymous FTP user
Uid : 1004
Class :
Groups : ftp
Home : /var/ftp
Shell : /usr/sbin/nologin
Locked : no
OK? (yes/no): yes
adduser: INFO: Successfully added (ftp) to the user database.
Add another user? (yes/no): no
Goodbye!
# mkdir -p /var/ftp/pub - # chown ftp:ftp /var/ftp/pub
To display a welcome notice before users login edit the /etc/ftpwelcome file:
# vi /etc/ftpwelcome
# vi /etc/ftpmod
# echo "ftp stream tcp nowait root /usr/libexec/ftpd ftpd -l -S -A -r" >> /etc/inetd.conf
-l default flag -r read-only mode -o write-only mode -A anonymous FTP connections only
-S logging of all anonymous FTP activity
- # touch /var/log/ftpd
# echo inetd_enable="YES" >> /etc/rc.conf
# /ect/rc.d/inetd start
# exit % ftp localhost
And were done ;)
Additional information:
man ftpd
man chroot
man inetd