Change vsftpd ftp server port 21

by Vivek Gite on December 12, 2006 · 5 comments

Q. Because of security issues I would like to change vsftpd port 21. How do I configure vsftpd to use other ports instead of default TCP port 21.

A. vsftpd, which stands for Very Secure FTP Daemon, is an FTP server under Ubuntu, Fedora Core, Red Hat Enterprise Linux and a number of other distributions.

Changing default port is good idea.

All you need to do is edit the configuration file for vsftpd server. The default configuration file is /etc/vsftp/vsftpd.conf or /etc/vsftpd.conf.

First login as root user

Open vsftpd.conf file
# vi vsftpd.conf

Find line that read as follows
listen_port=21

Replace port 21 with new port such as 201
listen_port=201

Save and close the file. 201 is port number you can set it to whatever port you want. Please make sure no other service use 201 port.

Now restart vsftpd
# /etc/init.d/vsftpd restart

Client need to use port 21 while connecting to ftp server:
$ ftp ftp.myserver.com 201

Featured Articles:

Share this with other sys admins!
Facebook it - Tweet it - Print it -

{ 5 comments… read them below or add one }

1 Dhiraj January 10, 2007

After changing the default port number not able to use ftp service from outside network. From Lan it is working fine

Reply

2 nixcraft January 10, 2007

Dhiraj

Make sure new port is open at firewall.

Reply

3 Bob December 7, 2009

@Dhiraj, Also make sure the chosen port is opened by port forwarding.

Reply

4 jake February 3, 2010

Thanks, works like a charm.

Reply

5 somanath August 5, 2010

Thanks. It is working great.

Reply

Leave a Comment

You can use these HTML tags and attributes for your code and commands: <strong> <em> <ol> <li> <u> <ul> <blockquote> <pre> <a href="" title="">
What is 14 + 14 ?
Please leave these two fields as-is:
Solve the simple math so we know that you are a human and not a bot.



Previous post:

Next post: