How To Configure FTP Server

What is FTP (File Transfer Protocol)-
FTP is a standard network protocol used to copy a files from one host to another over a TCP/IP-based network.






Description
Package
vsftpd
Port
20,21
Daemon*
vsftpd
Scripts
/etc/init.d/vsftpd
Configuration File
/etc/vsftpd/vsftpd.conf
/etc/vsftpd/ftpuser {users that deny}
/etc/vsftpd/ftp_user {users that deny

Note -Daemon are those services which are running Background

Server Side-

1. Install vsftpd Package..
#yum install vsftpd* -y

2. Create a directory
# mkdir /var/ftp/Data       {Data is a Directory Name}

3.  Create some file in this Directory /var/ftp/Data/
for Ex-
#cd /var/ftp/Data
#touch a1{1..10}

4. Restart The Services
#/etc/init.d/vsftpd restart

Client Side-

1. Install the ftp package
#yum install ftp* -y

2.Access the ftp 
#ftp 192.168.0.5           {192.168.0.5- server IP}
user: anonymous
password: anonymous        {Note-By Defaults Ftp user name and password - anonymous }

ftp>ls                                 {List all file}
ftp>cd Data                        {change directory}
ftp>ls                                  
ftp>get a1                           {To copy one file at a time from the remote ftp server to the local system}
ftp>bye                               {Exit the FTP session }


Server Side-




  • Disable anonymous  authentication-

1. Open configuration file..
#vi /etc/vsftpd/vsftpd.conf
anonymous_enable=YES       {yes=anonymous enable,no=Disable}


Save and exit.

2. Restart service..

#/etc/init.d/vsftpd restart


  • Anonymous upload-  (Obviously need to create a directory writable by the FTP user)                                            

1. Open configuration file..
#vi /etc/vsftpd/vsftpd.conf

#anon_upload_enable=YES   (remove the comment line no 27}


Save and exit.

2. Restart service..

#/etc/init.d/vsftpd restart

  • Disable and enable selinux
Note-
Selinux- (Security-Enhanced Linux)It is developed by NSA (National Security Agency).Selinux is a extra layer of the firewall. and it has define different-2 mode.                     
                                        
Getsebool- Getsebool  reports  where  a  particular SELinux boolean.                                
                           -a     Show all SELinux booleans.

Setsebool- Setsebool  sets  the current state of a particular SELinux  boolean                    

                           -p option is given, all pending values are written to the policy file on disk.                        
     
# getsebool -a | grep ftp
#  setsebool -P allow_ftpd_anon_write on
# sesebool -P  allow_ftpd_full_access on
# chmod 777 /var/ftp/pub
# /etc/init.d/vsftpd restart

Client Side-


# ftp  192.168.0.10

user  anonymous
password anonymous
ftp> ls
ftp> cd pub
ftp>ls
ftp>lcd /var/ftp/                     {Change current directory}

ftp> put a1 /Data/fiel1           {Upload lfile with remote name rfile}

Server Side-



  • Create ftp user and password-
1. Create user
#adduser -c 'FTP USER TOM' -m tom
#passwd tom

2.Open configuration file..
#vi /etc/vsftpd/vsftpd.conf

#anonymous_enable=YES
                                   {Uncomment this to allow local users to log in.}

3. Restart service..
#/etc/init.d/vsftpd restart

_____________________________________________________________________________________________
Click Back..                                Click Home..