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:
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- My 10 UNIX Command Line Mistakes
- 10 Greatest Open Source Software Of 2009
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- Top 20 OpenSSH Server Best Security Practices
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Linux Video Editor Software
- Email FAQ to a friend
- Download PDF version
- Printable version
- Comment RSS feed
- Last Updated: 12/12/06


{ 4 comments… read them below or add one }
After changing the default port number not able to use ftp service from outside network. From Lan it is working fine
Dhiraj
Make sure new port is open at firewall.
@Dhiraj, Also make sure the chosen port is opened by port forwarding.
Thanks, works like a charm.