Saturday, July 11, 2009

Configure FTP On Ubuntu

FTP can be configured easily on ubuntu. It will work as central store of data in network.just few steps and editing of confug file your FTP is ready...:)...lets see

The configuration of the vsftpd FTP service

Step-1:Type apt-get command to install vsftpd
$ sudo apt-get install vsftpd
Output:
Password:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
vsftpd
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 121kB of archives.
After unpacking 438kB of additional disk space will be used.
Get:1 http://us.archive.ubuntu.com edgy/main vsftpd 2.0.4-0ubuntu5 [121kB]
Fetched 121kB in 0s (246kB/s)
Selecting previously deselected package vsftpd.
(Reading database ... 31396 files and directories currently installed.)
Unpacking vsftpd (from .../vsftpd_2.0.4-0ubuntu5_amd64.deb) ...
Setting up vsftpd (2.0.4-0ubuntu5) ...
Adding system user `ftp' with uid 106...
Adding new user `ftp' (106) with group `nogroup'.
Not creating home directory `/home/ftp'.
* Starting FTP server: vsftpd

Step # 2: Configure /etc/vsftpd.conf

The default vsftpd configuration file is /etc/vsftpd.conf. You need to edit this file using text editor such as vi:

$ sudo vi /etc/vsftpd.conf
Add the following line (uncomment line) to the vsftpd configuration file:
local_enable=YES
Above config directive will allow local users to log in via ftp
If you would like to allow users to upload file, add the following to the file:
write_enable=YES
FTP Users with Only Read Access to a Shared Directory
In this example, anonymous FTP is not desired, but a group of trusted users need to have read only access to a directory for downloading files. Here are the steps:
1) Disable anonymous FTP. Comment out the anonymous_enable line in the vsftpd.conf file like this:
# Allow anonymous FTP?
anonymous_enable=NO
2) Enable individual logins by making sure you have the local_enable line uncommented in the vsftpd.conf file like this:
# Uncomment this to allow local users to log in.
local_enable=YES
3) Start VSFTP.
[jitu@erp tmp]# service vsftpd start
Create a user group and shared directory
In this case, use /home/ftp-users and a user group name of ftp-users for the remote users
[jitu@erp tmp]# groupadd ftp-users
[jitu@erp tmp]# mkdir /home/ftp-docs
4) Make the directory accessible to the ftp-users group.
[jitu@erp tmp]# chmod 750 /home/ftp-docs
[jitu@erp tmp]# chown root:ftp-users /home/ftp-docs
5) Add users, and make their default directory /home/ftp-docs
[jitu@erp tmp]# useradd -g ftp-users -d /home/ftp-docs user1
[jitu@erp tmp]# useradd -g ftp-users -d /home/ftp-docs user2
[jitu@erp tmp]# useradd -g ftp-users -d /home/ftp-docs user3
[jitu@erp tmp] useradd -g ftp-users -d /home/ftp-docs user4
[jitu@erp tmp]# passwd user1
[jitu@erp tmp]# passwd user2
[jitu@erp tmp]# passwd user3
[jitu@erp tmp]# passwd user4
6) Copy files to be downloaded by your users into the /home/ftp-docs directory
7) Change the permissions of the files in the /home/ftp-docs directory for read only access by the group
[jitu@erp tmp]# chown root:ftp-users /home/ftp-docs/*
[jitu@erp tmp]# chmod 740 /home/ftp-docs/*
Sample Login Session To Test Functionality

type in your favourite browser
ftp://localhost/
you will be asked for username and password,enter it and enjoy!!

thats it!!

No comments:

Post a Comment