Configure the FTP server in Linux

Now, Finally login into client machine, access the ftp server and try uploading the files in it.

[root@client1 ~]# ftp 192.168.1.10
Connected to 192.168.1.10 (192.168.1.10).
220 (vsFTPd 3.0.2)
Name (192.168.1.10:gaurav): ftp
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> cd pub
250 Directory successfully changed.
ftp> cd Shared
250 Directory successfully changed.
ftp> ls
227 Entering Passive Mode (192,168,1,10,57,23).
150 Here comes the directory listing.
226 Directory send OK.
ftp> !ls
anaconda-ks.cfg  anaconda-screenshots  linuxservers.doc
ftp> put linuxservers.doc
local: linuxservers.doc remote: linuxservers.doc
227 Entering Passive Mode (192,168,1,10,160,121).
150 Ok to send data.
226 Transfer complete.
ftp> ls
227 Entering Passive Mode (192,168,1,10,164,163).
150 Here comes the directory listing.
-rw-------    1 14       50              0 Sep 18 08:12 linuxservers.doc
226 Directory send OK.
ftp>

Now we made an ftp server for uploading files with anonymous user.!!!

Some Tips and Tricks on FTP sever.

Disable anonymous user and Login on web browser using normal user (or system users like gaurav).

Go to line no. 12 in /etc/vsftpd/vsftpd.conf file on ftp server and change the parameter “anonymous_enable=no”, as shown below.

#
# Allow anonymous FTP? (Beware - allowed by default if you comment this out).
anonymous_enable=no
#

Restart the vsftpd service

[root@server1 ~]# systemctl restart vsftpd.service

Open the web browser  type the ftp server’s ip address, then it will ask username and password as following.

ftp2

User Gaurav successfully login on ftp server.

ftp3

Create a “gaurav” user with specific /dir/ access on ftp server.

Make a directory and create some files on it and bind with home directory of “gaurav” user

[root@server1 ~]# mkdir /shareddir
[root@server1 ~]# cd /shareddir/
[root@server1 shareddir]# touch ftpfile{1..10}
[root@server1 shareddir]# ls
ftpfile1   ftpfile2  ftpfile4  ftpfile6  ftpfile8
ftpfile10  ftpfile3  ftpfile5  ftpfile7  ftpfile9
[root@server1 shareddir]# mount --bind /shareddir/ /home/gaurav/
[root@server1 shareddir]#

Now try login from client machine.

ftp2

Now you can see that “gaurav” user have the access of specific directory.

ftp10

To Deny the “gaurav” user access to ftp server.

Edit the file “/etc/vsftpd/user_list” and “/etc/vsftpd/ftpusers” and  add the name of user.

#vim /etc/vsftpd/user_list

# Note that the default vsftpd pam config also checks /etc/vsftpd/ftpusers
# for users that are denied.
gaurav
root

~
~
:wq

#vim /etc/vsftpd/ftpusers

# Users that are not allowed to login via ftp
gaurav
root

~
~
:wq

Restart the vsftpd service.

[root@server1 ~]# systemctl restart vsftpd.service

Now try login from client machine.

ftp2

Its showing login error.

ftp6

Maximum number of clients that may be connected with ftp server.

Edit the ftp server configuration file i.e (/etc/vsftpd/vsftpd.conf) and set the below parameter.

max_clients=5

#vim /etc/vsftpd/vsftpd.conf

# files.
# Make sure, that one of the listen options is commented !!
listen_ipv6=YES

pam_service_name=vsftpd
userlist_enable=YES
tcp_wrappers=YES
max_clients=5

~
~
:wq

Restart the vsftpd service.

[root@server1 ~]# systemctl restart vsftpd

Now try login from client machine. Once ftp server reached “5” max. client , then it will show the below error.

[root@client1 ~]#ftp 192.168.1.10
Connected to 192.168.1.10.
421 There are too many connected users, please try later.
ftp>

Maximum connections per IP address  that may be connected with ftp server .

#vim /etc/vsftpd/vsftpd.conf

# Make sure, that one of the listen options is commented !!
listen_ipv6=YES

pam_service_name=vsftpd
userlist_enable=YES
tcp_wrappers=YES
max_clients=5
max_per_ip=10

~
~
:wq

Restart the vsftpd service.

[root@server1 ~]# systemctl restart vsftpd

Try login from client machine. Once ftp server reached “10” max. per Ip address , then it will show the below error.

[root@client1 ~]#ftp 192.168.1.10
Connected to 192.168.1.10.
421 There are too many connections from your internet address.
ftp>

That’s up with ftp server configuration and some tricks on ftp server.!!!!

Read Also Configure vsftpd with SSL/TLS on Centos7/RHEL7/Fedora22

Leave a Reply

Be the First to Comment!

Notify of
avatar
wpDiscuz