https://ostechnix.wordpress.com/2013/12/15/setup-ftp-server-step-by-step-in-centos-6-x-rhel-6-x-scientific-linux-6-x/
This tutorial shows the install and configure FTP server in CentOS 6.5. Though The steps provided here is tested in CentOS 6.5, it should work on RHEL 6.x (x stands for version) and scientific L Inux 6.x too. In this tutorial my FTP server IP and hostname is 192.168.1.200 andmainserver.ostechnix.com respectively. I have already configured a local repository and I am gonna to install the FTP from my local repository. For more information navigate to setup your local repoistory in CentOS 6/rhel 6/scientific Linux.
Before proceed, stop the firewall.
[[Email protected] ~]# service iptables stop
iptables:flushing firewall rules: [OK]
Iptables:setting chains to Policy Accept:filter [OK]
iptables:unloading modules: [OK]
[[Email protected] ~]# service Ip6tables stop
ip6tables:flushing firewall rules: [OK]
Ip6tables:setting chains to Policy Accept:filter [OK]
ip6tables:unloading modules: [OK]
[Email protected] ~]# chkconfig iptables off
[Email protected] ~]# Chkconfig ip6tables off
[Email protected] ~]#
Now let us install the FTP service.
[email protected] ~]# Yum install-y vsftpd
[[email protected] ~]# Start vsftpd service.
[[Email protected] ~]# service VSFTPD start
Starting vsftpd for VSFTPD: [OK]
[Email protected] ~]#
Enable vsftpd in multi-user levels.
[Email protected] ~]# chkconfig vsftpd on
Now edit the/etc/vsftpd/vsftpd.conf file. Uncomment and edit the lines in the vsftpd.conf file which is shown in bold.
[Email protected] ~]# cat/etc/vsftpd/vsftpd.conf
# Example Config file/etc/vsftpd/vsftpd.conf
#
# The default compiled in Settings is fairly paranoid. This sample file
# loosens things up a bit, to make the FTP daemon more usable.
# vsftpd.conf.5 See the compiled in defaults.
#
# READ This:this Example file is a exhaustive list of vsftpd options.
# Please read the VSFTPD.CONF.5 manual page to get a full idea of vsftpd ' s
# capabilities.
#
# Allow anonymous FTP? (beware-allowed by default if you comment this out).
Anonymous_enable=no
#
# Uncomment this to allow local users to log in.
Local_enable=yes
#
# Uncomment this to enable any form of FTP write command.
Write_enable=yes
#
# Default Umask for Local Users is 077. If you are wish to 022,
# If your users expect that (022 was used by the most other ftpd ' s)
local_umask=022
#
# Uncomment the anonymous FTP user to upload files. This only
# has a effect if the above global write enable is activated. Also, you'll
# obviously need to create a directory writable by the FTP user.
#anon_upload_enable =yes
#
# Uncomment this if you want the anonymous FTP user to being able to create
# New directories.
#anon_mkdir_write_enable =yes
#
# Activate Directory messages-messages given to remote users when they
# go into a certain directory.
Dirmessage_enable=yes
#
# The target log file can be Vsftpd_log_file or xferlog_file.
# This depends on setting Xferlog_std_format parameter
Xferlog_enable=yes
#
# Make sure port transfer connections originate from port (ftp-data).
Connect_from_port_20=yes
#
# If you want, you can arrange for uploaded anonymous files to being owned by
# a different user. note! Using "root" for uploaded files are not
# recommended!
#chown_uploads =yes
#chown_username =whoever
#
# The name of the log file when Xferlog_enable=yes and Xferlog_std_format=yes
# warning-changing This filename affects/etc/logrotate.d/vsftpd.log
#xferlog_file =/var/log/xferlog
#
# switches between logging into Vsftpd_log_file and xferlog_file files.
# NO writes to Vsftpd_log_file, YES to Xferlog_file
Xferlog_std_format=yes
#
# You could change the default value of timing out an idle session.
#idle_session_timeout =600
#
# The default value for timing out a data connection.
#data_connection_timeout =120
#
# It is recommended so define on your system a unique user which the
# FTP server can use as a totally isolated and unprivileged user.
#nopriv_user =ftpsecure
#
# Enable This and the server would recognise asynchronous ABOR requests. Not
# Recommended for security (the code is non-trivial). Not enabling it,
# However, may confuse older FTP clients.
#async_abor_enable =yes
#
# By default the server would pretend to allow ASCII mode but in fact ignore
# the request. Turn on the below options to has the server actually do ASCII
# mangling on files while in ASCII mode.
# beware, some FTP servers, ASCII support allows a denial of service
# Attack (DoS) via the command "Size/big/file" in ASCII mode. Vsftpd
# predicted this attack and have always been safe, reporting the size of the
# RAW file.
# ASCII mangling is a horrible feature of the protocol.
Ascii_upload_enable=yes
Ascii_download_enable=yes
#
# fully customise the login banner string:
Ftpd_banner=welcome to Ostechnix FTP service.
#
# You may specify a file of disallowed anonymous e-mail addresses. Apparently
# Useful for combatting certain DoS attacks.
#deny_email_enable =yes
# (default follows)
#banned_email_file =/etc/vsftpd/banned_emails
#
# Specify an explicit list of the Local users to Chroot () to their home
# directory. If Chroot_local_user is YES and then this list becomes a list of
# users to not Chroot ().
#chroot_local_user =yes
#chroot_list_enable =yes
# (default follows)
#chroot_list_file =/etc/vsftpd/chroot_list
#
# You may activate the "-r" option to the builtin LS. This was disabled by
# default to avoid remote users being able to cause excessive I/O on large
# sites. However, some broken FTP clients such as "ncftp" and "mirror" assume
# The presence of the "-r" option, so there was a strong case for enabling it.
Ls_recurse_enable=yes
#
# when "Listen" directive are enabled, VSFTPD runs in standalone mode and
# listens on IPV4 sockets. This directive cannot is used in conjunction
# with the Listen_ipv6 directive.
Listen=yes
#
# This directive enables listening on IPV6 sockets. To listen on IPV4 and IPV6
# sockets, you must run the copies of vsftpd with the configuration files.
# Make sure, which one of the listen options is commented!!
#listen_ipv6 =yes
Pam_service_name=vsftpd
Userlist_enable=yes
Tcp_wrappers=yes
Use_localtime=yes
Now let us restart the VSFTPD service and try to connect to the FTP server.
[Email protected] ~]# service vsftpd restart
Shutting down VSFTPD: [OK]
Starting vsftpd for VSFTPD: [OK]
Connect to the FTP server.
Note:root is not allowed to connect to the FTP server by default for security purpose. So lets us create a new user called Ostechnix.
[Email protected] ~]# Useradd Ostechnix
[Email protected] ~]# passwd Ostechnix
Changing password for user Ostechnix.
New Password:
Bad Password:it are based on a dictionary word
Retype new Password:
Passwd:all authentication tokens updated successfully.
Connet to FTP server using the new user Ostechnix.
[[Email protected] ~]# FTP 192.168.1.200
-bash:ftp:command not found
[Email protected] ~]#
oops! FTP package was not installed. So let us install the FTP package first.
[[email protected] ~]# Yum install-y ftp
Loaded Plugins:fastestmirror
Loading mirror speeds from cached hostfile
Setting up Install Process
Resolving Dependencies
--Running Transaction check
---> Package ftp.i686 0:0.17-51.1.el6 'll be installed
--Finished Dependency Resolution
Dependencies resolved
================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
FTP i686 0.17-51.1.el6 Localrepo k
Transaction Summary
================================================================================
Install 1 package (s)
Total Download size:55 k
Installed size:91 K
Downloading Packages:
Running Rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning:rpmdb altered outside of Yum.
installing:ftp-0.17-51.1.el6.i686 1/1
verifying:ftp-0.17-51.1.el6.i686 1/1
Installed:
ftp.i686 0:0.17-51.1.el6
complete!
[Email protected] ~]#
Again Connect to the FTP server.
[[Email protected] ~]# FTP 192.168.1.200
Connected to 192.168.1.200 (192.168.1.200).
Welcome to Ostechnix FTP service.
Name (192.168.1.200:root): Ostechnix
331 Specify the password.
Password:
Oops:cannot Change Directory:/home/ostechnix
Login failed.
Ftp>
It shows a error that the user cannot change to his $HOME directory. Type exit to return back from the FTP console and allow VSFTPD daemon to change users into their $HOME directories. To does that update the SELinux configuration using the command below.
[Email protected] ~]# setsebool-p Ftp_home_dir on
And finally connect to the FTP server.
[[Email protected] ~]# FTP 192.168.1.200
Connected to 192.168.1.200 (192.168.1.200).
Welcome to Ostechnix FTP service.
Name (192.168.1.200:root): Ostechnix
331 Specify the password.
Password:
Successful Login.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> pwd
257 "/home/ostechnix"
Ftp>
Its working now. You can use your FTP server.
Connect to FTP server using Filezilla from Client:
Download and install Filezilla client software to any one of the client systems. Open The Filezilla client and enter the username and password which we have created earlier and click Connect.
Connect to FTP server via browser from the client:
Open the browser and navigate to ftp://192.1168.1.200. Enter the username and password which we cretaed earlier.
If you want to browse FTP server using domain name (i.e ftp://ostechnix.com) instead of IP address, add the FTP server IP i n the DNS server records. For the information to configure DNS server navigate to Setup the DNS server in CentOS 6.3/rhel 6.3/scientific Linux 6.3.
Thats it. You can access the your FTP server from the any client now using Filezilla and as well as the from your client Web browser.
Has a good day!!!
Setup FTP Server Step by step in centos/rhel/scientific Linux 6.3/6.4/6.5