Wednesday, October 14, 2009

How to setup an ftp server on Linux

[root@roni ~]# yum install vsftpd

Loaded plugins: fastestmirror

Loading mirror speeds from cached hostfile

* base: mirror.cs.vt.edu

* updates: mirror.atlanticmetro.net

* addons: chi-10g-1-mirror.fastsoft.net

* extras: updates.interworx.info

Setting up Install Process

Parsing package install arguments

Package vsftpd-2.0.5-12.el5_3.1.i386 already installed and latest version

Nothing to do

[root@roni ~]# vi /etc/vsftpd/vsftpd.conf

Find and edit

xferlog_std_format=NO
log_ftp_protocol=YES
chroot_local_user=YES
banner_file=/etc/vsftpd/issue

to create a message compliant with the local site policy or a legal disclaimer:

[root@roni ~]# vi /etc/vsftpd/issue

NOTICE

Put whatever your message to the user.......

[root@roni ~]# chkconfig vsftpd on

[root@roni ~]# service vsftpd start

Starting vsftpd for vsftpd: [ OK ]

[root@roni ~]# netstat -tulpn | grep :21

tcp 0 0 0.0.0.0:21 0.0.0.0:* LISTEN 29119/vsftpd

[root@roni ~]# vi /etc/sysconfig/iptables

Add this line

RH-Firewall-1-INPUT -m state --state NEW -p tcp --dport 21 -j ACCEPT

[root@roni ~]# vi /etc/sysconfig/iptables-config

Edit

IPTABLES_MODULES="ip_conntrack_ftp"

[root@roni ~]# service iptables restart

to view the log file

[root@roni ~]# tail -f /var/log/vsftpd.log

Wed Jul 8 08:23:01 2009 [pid 2379] [ftp] FTP command: Client "202.148.56.8", "CWD /srv/"

Wed Jul 8 08:23:01 2009 [pid 2379] [ftp] FTP response: Client "202.148.56.8", "550 Failed to change directory."

Wed Jul 8 08:23:01 2009 [pid 2383] [ftp] FTP command: Client "202.148.56.8", "PWD"

Wed Jul 8 08:23:01 2009 [pid 2383] [ftp] FTP response: Client "202.148.56.8", "257 "/""

Wed Jul 8 08:23:01 2009 [pid 2383] [ftp] FTP command: Client "202.148.56.8", "CWD /srv/svn/"

Wed Jul 8 08:23:01 2009 [pid 2383] [ftp] FTP response: Client "202.148.56.8", "550 Failed to change directory."

Wed Jul 8 08:23:02 2009 [pid 2383] [ftp] FTP command: Client "202.148.56.8", "NOOP"

Wed Jul 8 08:23:02 2009 [pid 2383] [ftp] FTP response: Client "202.148.56.8", "200 NOOP ok."

Wed Jul 8 08:23:02 2009 [pid 2383] [ftp] FTP command: Client "202.148.56.8", "CWD /srv/svn/RONI/"


No comments:

Post a Comment