Change vsftpd ftp server port 21

by Vivek Gite · 4 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:

Want to read Linux tips and tricks, but don't have time to check our blog everyday? Subscribe to our daily email newsletter to make sure you don't miss a single tip/tricks. Subscribe to our weekly newsletter here!

{ 4 comments… read them below or add one }

1 Dhiraj 01.10.07 at 12:30 pm

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

2 nixcraft 01.10.07 at 1:52 pm

Dhiraj

Make sure new port is open at firewall.

3 Bob 12.07.09 at 5:41 pm

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

4 jake 02.03.10 at 5:46 am

Thanks, works like a charm.

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Previous FAQ:

Next FAQ:

nixCraft FAQ PDF Collection Now Available To All