Sunday, August 15, 2010

FTP TUTORIAL ON UBUNTU

FTP is a protocol that is very old, but although it is still widely used for file transfers. Perhaps because of its stability and the number of client or application that supports file transfer via ftp, which cause the ftp is still very popular.

Installation
Install proftpd in Ubuntu, as easy as installing another application from the repository. How,
sudo apt-get install proftpd


We have a choice whether to run proftpd via inetd or standalone, select a standalone course. Once installation is complete,
it should automatically run proftpd. If not, you just run the following command.
sudo / etc / init.d / proftpd start
Location of configuration files in / etc / proftpd / proftpd.conf. The example given by the package proftpd in Ubuntu is very good. But of course, you still can reconfigure it to better suit your needs.


Test Installation
Before discussing the configuration for proftpd, let's spend a little time to do a little test. After successfully running proftpd, you can do process checks, whether proftpd already listen or not.
sudo lsof-i-n-P | grep "21" | grep Listen
If proftpd is listen on port 21 is, then let's check. As in the example below.
ftp localhost
Connected to localhost.
220 proftpd 1.3.1 Server (Debian) [:: FFFF: 127.0.0.1]
Name (localhost: Cecep): Hendro
XXX Password required for Hendro
Password: XXXXXX


Hendro 230 User logged in.

Remote system type is UNIX.
Using binary mode to transfer files.
dir" onmouseover="this.style.backgroundColor='#ebeff9'" onmouseout="this.style.backgroundColor='#fff'">ftp> dir
200 PORT Command Successful
150 Opening ASCII mode data connection for file list


-Rw-r - r - 1 root root 3169166 May 22 09:26 redmine-0.8.4.tar.gz
drwxr-xr-x 7 Hendro Hendro May 22 4096 22:22 rubygems-1.3.5
-Rw-r - r - 1 Hendro Hendro 228 426 May 22 00:16 rubygems-1.3.5.tgz


226 Transfer complete
" onmouseover="this.style.backgroundColor='#ebeff9'" onmouseout="this.style.backgroundColor='#fff'">ftp>
Restrict FTP user in homedir
See proftpd.conf configuration, find the line DefaultRoot, you live throw a hash mark in front, like the example below.
# Use this to jail all users in on their homes
DefaultRoot ~
As always, if you have saved the new configuration, you must restart the proftpd service.
sudo / etc / init.d / proftpd restart
Files that may restrict the uploads
For example, you create a ftp server for office supplies. And you do not want your users to upload mp3 files and videos that may not be related to office supplies.
You can apply the following configuration.
# Reject files with this extension
PathDenyFilter "\ \. (3gp | avi | mp3 | mpg | wmv) $"
Another example, you want to limit file size to be uploaded.
# Restrict uploads to only 10 megabytes
MaxStoreFileSize 10 Mb


Tuning For the Super Busy Server
If your FTP server is very busy, maybe you should change several Timeout configuration for clients that do not transfer conditions, stalled or being idle. The goal is that client-server client is not a burden, and provide opportunities to other clients who want to access your server.
The default value in the Ubuntu installation, remember the unit in seconds. So 600 means 10 minutes.
TimeoutNoTransfer 600
TimeoutStalled 600
TimeoutIdle 1200
You can change the example to be like below.
TimeoutNoTransfer 60
TimeoutStalled 60
TimeoutIdle 120
You also might be able to apply additional configuration as below.
# Disable IDENT lookups
IdentLookups off

# Disable Reverse DNS lookups
UseReverseDNS off

# Disable the ls-R
ListOptions + R is strictly

# Disable checking for. Ftpaccess
AllowOverride off

# Disable logging to wtmp file

No comments:

Post a Comment