Change FTP Port?

My website has been hacked and i assume it was because they got hold of my FTP username and password.

would i be able to change the FTP port from 21 to another number.

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

Replace port 21 with new port such as 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 201