Wednesday, July 17, 2013

Configure FTP Server in RHEL6


In this topic, we look at File Transfer Protocol (FTP) and how it can be used to
share files or provide them in an easy manner over the network. Almost all major
computer makers (HP, Dell, Apple) offer drivers for their systems over FTP, which
allows for simple download by end users.

Here we will use the vsftpd package, which stands for Very Secure FTP Daemon.
This particular FTP server offers additional features that make it a more secure
choice if you have to use FTP.

Step 1. Install the required package:
# yum install -y vsftpd

#cd /var/ftp/pub
create or copy some files or directory that you want to share trough ftp

Step 2. Ensure that the service will start on system boot:
# chkconfig vsftpd on

there is only one main config file; it’s located at /etc/vsftpd/vsftpd.conf,
which is where you configure the settings of the FTP server.
-------------------------------------------------------------------------------------------------
Step 3. Look at which important options are available in the config file:
#vim /etc/vsftpd/vsftpd.conf

anonymous_enable=YES        The default; sets security, although it should be
                                                change to NO for better host-based security

write_enable=YES                   Enables users to write to directories

dirmessage_enable=YES         Displays directory messages

listen=YES                               Allows the server to listen for connections

userlist_enable=YES                Enables the service to consult user_list

tcp_wrappers=YES                  Allows incoming requests based on the TCP Wrappers
                                                configuration
userlist_deny=YES                   Enables users listed in user_list to deny from log
                                                in via FTP change options according to your need
                                                then save and exit
--------------------------------------------------------------------------------------------------
Step 4. Use the iptables command to create your firewall rules:
# iptables -I INPUT  -p tcp -m tcp —dport 20 -j ACCEPT
# iptables -I INPUT  -p tcp -m tcp —dport 21 -j ACCEPT

# service iptables save

# service iptables restart

Disable the SELinux protection:
# setsebool -P allow_ftpd_full_access=1

#service vsftpd restart

now open Browser and try to open URL ftp://ftpserverip

---------------------------------------------------------------------------------------------------
FTP User Authentication:

This is required when you want to set username and password to access
ftp site to do thisyou need to make some changes in config file, let us
to try:

#vim /etc/vsftpd/vsftpd.conf

anonymous_enable=NO
userlist_deny=NO
save and exit
#vim /etc/vsftpd/user_list

here is the list of users that are allowed to acces ftp server, type your
own user that you want to allow for ftp login
save and exit

#service vsftpd restart

now try to open ftp site again it should ask for authentication

No comments:

Post a Comment