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.
I'm fully aware of the security implications regarding FTP's transmission of usernames and passwords in clear text hence the choice of an anonymous FTP server in real-only mode.
Let's 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 we're done ;)
Additional information:
man ftpd
man chroot
man inetd
2 comments:
Thank you, this helped me alot!
Glad it helped ;)
Post a Comment