220 likes | 780 Views
FTP SERVER. LINUX. By Chinedu Eze Richard Ajayi. WHAT IT IS:. F – File T - Transfer P – Protocol A protocol for transferring data between host computers and remote servers - FTP server – a server / software that runs the FTP protocol for transferring and manipulating files.
E N D
FTP SERVER LINUX By Chinedu Eze Richard Ajayi
WHAT IT IS: F – File T - Transfer P – Protocol • A protocol for transferring data between host computers and remote servers - FTP server – a server / software that runs the FTP protocol for transferring and manipulating files.
ADVANTAGES: • Resume aborted uploads/downloads • Easy to use esp. large file upload download handling • Lower band width consumption • Built in error checking • Fast • Many more… DISADVANTAGE: • Not secured as passwords and usernames are sent in plain text – Sftp • Users may be able to compromise system
Solution: • Ch’Root FTP • All users are virtual – system only see a single user…all ftp users are under this one user • Users are automatically redirected to their home directory • Ftp users do not have bash or any other shell • But they got a few ‘mild’ commands e.g. ‘ls’, ‘mkdir’… • Users cannot access system files • …many other restrictions apply depending on choice of administrator.
Our choice of FTP server: • Pure-FTPd server • Its secured, small in size and very easy to install and configure…well, ‘easy’??? • written by ArntGulbrandsen around 1995 • based on Troll-FTPd • Free - BSD license; open source??? • Does not need configuration files; settings are given as command line arguments and changes are applied on the fly • However, configuration files cóuld be used if prefered
Procedures: • install pure-ftpd: • #sudo apt-get install pure-ftpd pure-ftpd-common ---server is started automatically with default settings • Create a group for the ftp server users: • #sudo groupadd ftpgroup • ---all ftp server users would belong exclusively to this group
Procedures: Cont’d… • Create the ftp system user: • #sudo useradd -g ftpgroup -d /dev/null -s /etc ftpuser • -g ftpgroup: the group that was previously created to ftpusers • -d /dev/null: this user do not a home directory • -s /etc: this user do not have a command line interpreter e.g. bash • ftpuser: this is the name of the user; all the ftp user belong to this user… the system only sees this user
Procedures: Cont’d… • Create home directory for the ftp users (base directory): • #sudo mkdir /home/ftpusers • create directory for each ftp user: • #sudo mkdir /home/ftpusers/username • ---user dir: ftpuser001 – ftpuser005 • add the user to the pure-ftpd : • #sudo pure-pw useradd username -u ftpuser -d /home/ftpusers/username • ---username: ftpuser001 • ---pure-pw: pureftpd command
Procedures: Cont’d… • After adding the users, create/update the user database: • #sudo pure-pw mkdb • create symbolic links between the respective files: • #sudo ln -s /etc/pure-ftpd/pureftpd.passwd /etc/pureftpd.passwd • #sudo ln -s /etc/pure-ftpd/pureftpd.pdb /etc/pureftpd.pdb • #sudo ln -s /etc/pure-ftpd/conf/PureDB /etc/pure-ftpd/auth/PureDB • ---so that they are accessible from the etc folder directly
Procedures: Cont’d… • permissions of /home/ftpusers and subdirectories: • #chown -hR -v ftpuser:ftpgroup /home/ftpusers • ---owner is ftpuser • ---group is ftpgroup • lastly restart PureFTPD: • #sudo /etc/init.d/pure-ftpd restart • ...then issue this command: • #/usr/sbin/pure-ftpd -S 192.168.10.50,21 -c 10 -C 2 -l puredb:/etc/pureftpd.pdb -X -E -j -R -T 100 -k 90 -A -u 100
Meaning of command: • #/usr/sbin/pure-ftpd – name of the pureftpd service • -S 192.168.10.50,21 – bound server to that address and that port • -c 10 – maximum of 10 simultaneous users • -C 2 – maximum of 2 simultaneous users on the same IP address • -l puredb:/etc/pureftpd.pdb – authenticate users with this database instead of the linux authentication for example • -X – users do not access hidden files • Type “man pure-ftpd” for more details and more commands
Meaning of command: • -E – only authenticated users (no anonymous allowed) • -j – create user directories at user creation if not specified • -R – chmod command not allowed • -T 100 – upload and download bandwidth limit is 100 KB/s • -k 90 – no uploads for disk 90% full • -A – everyone is chrooted except root • -u 100 – uid’s below 100 not allowed (they should be for system admins’)
Thanks for your time • References: • http://www.chinalinuxpub.com/doc/www.siliconvalleyccie.com/index.htm • http://www.linuxhomenetworking.com/ • http://www.roseindia.net/linux/linux-ftp-server-how-to.shtml • http://www.faqs.org/docs/Linux-mini/FTP.html#toc6 • http://www.faqs.org/docs/securing/chap29sec298.html • http://www.debianhelp.co.uk/pureftp.htm • http://linuxservertutorials.blogspot.com/2008/11/configure-ftp-server-on-ubuntu.html • http://en.wikipedia.org/wiki/Pure-FTPd