How to configure FTP server on Redhat & debian based system

How to configure FTP server on Redhat & debian based system

Introduction – FTP is File Transfer Protocol, the protocol for exchanging files over the Internet. FTP uses the Internet’s TCP/IP protocols to enable data transfer

What is anonymous FTP?

Anonymous FTP is a privilege granted by the organization that owns the computer to which you are connecting by using FTP without any restriction. FTP runs exclusively over TCP. FTP servers by default listen on port 21 for incoming connections from FTP clients

Type of FTP connection?

1) In active mode, the FTP client opens a random port (> 1023), sends the FTP server the random port number on which it is listening over the control stream and waits for a connection from the FTP server. When the FTP server initiates the data connection to the FTP client it binds the source port to port 20 on the FTP server.

2)
In passive mode, the FTP server opens a random port (> 1023), sends the FTP client the server’s IP address to connect to and the port on which it is listening (a 16 bit value broken into a high and low byte, like explained before) over the control stream and waits for a connection from the FTP client. In this case the FTP client binds the source port of the connection to a random port greater than 1023.

3) In extended passive mode, the FTP server operates exactly the same as passive mode, however it only transmits the port number (not broken into high and low bytes) and the client is to assume that it connects to the same IP address that was originally connected to

ftpserver

List of FTP Server –

The ProFTP , vsFTP and Pure-FTP are the widely used FTP servers.

1] How to Setup FTP server on Redhat/Fedora

For this post I am using vsFTP server on Fedora..

[root@indianGNU.org vsftpd]# pwd
/etc/vsftpd
[root@indianGNU.org vsftpd]# ls
chroot_list ftpusers user_list vsftpd.conf vsftpd_conf_migrate.sh
[root@indianGNU.org vsftpd]#

Configuration file of vsFTP server –

[root@indianGNU.org vsftpd]# cat vsftpd.conf
# Example config file /etc/vsftpd/vsftpd.conf
#
##anonymous disabled
#anonymous_enable=YES
#
# allow local users to log in.
local_enable=YES
#
# enable any write operation form of FTP.
write_enable=YES
#
# Default umask for local users is 077.
local_umask=022
#
# messages given to remote users when they go into a certain directory.
dirmessage_enable=YES
#
# Activate logging of uploads/downloads.
xferlog_enable=YES
#
# Make sure PORT transfer connections originate from port 20 (ftp-data).
connect_from_port_20=YES
#
# If you want, you can have your log file in standard ftpd xferlog format
xferlog_std_format=YES
#
#chroot_list_file=/etc/vsftpd/chroot_list
chroot_local_user=YES
userlist_deny=NO
pam_service_name=vsftpd
userlist_enable=YES
#enable for standalone mode
listen=YES
tcp_wrappers=YES
[root@indianGNU.org vsftpd]#

2] Add FTP users who will use FTP service –

[root@indianGNU.org vsftpd]# tail /etc/passwd
…..

…..

reply:x:553:553::/home/reply:/bin/bash
arun:x:544:544::/var/www/indianGNU.org/html:/sbin/nologin
[root@indianGNU.org vsftpd]#

3] Add user in “/etc/vsftpd/user_list file” to login via FTP –

[root@indianGNU.org vsftpd]# cat  /etc/vsftpd/user_list
# vsftpd userlist
# If userlist_deny=NO, only allow users in this file
# If userlist_deny=YES (default), never allow users in this file, and
# do not even prompt for a password.
# Note that the default vsftpd pam config also checks /etc/vsftpd/ftpusers
# for users that are denied.
arun
myftp
ftpuser

[root@indianGNU.org vsftpd]#
4] Now restart your FTP service and try to login —

[root@indianGNU.org vsftpd]# ftp localhost
Connected to localhost.
220 (vsFTPd 2.0.4)
530 Please login with USER and PASS.
530 Please login with USER and PASS.
KERBEROS_V4 rejected as an authentication type
Name (localhost:root): arun
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> pwd
257 “/”

ftp> ls
227 Entering Passive Mode (127,0,0,1,213,215)
150 Here comes the directory listing.
-rwxrwxrwx 1 0 0 66 Jan 15 12:10 index.php
-rwxrwxrwx 1 0 0 21 Jan 08 13:32 myinfo.php
drwxrwxrwx 5 0 0 4096 Jan 09 04:32 sendmail
drwxr-xr-x 5 0 0 4096 Jan 10 07:13 test.txt

226 Directory send OK.
ftp> bye
221 Goodbye.
[root@indianGNU.org vsftpd]#

Thank you,

Arun

Similar Posts:

Leave a Reply

Your email address will not be published.