To change the port number used by the vsftpd FTP server from the default value of 21, you will need to edit the configuration file for the vsftpd server. The configuration file is typically located at /etc/vsftpd/vsftpd.conf
.
To change the port number, open the configuration file in a text editor using the following command:
sudo nano /etc/vsftpd/vsftpd.conf
Then, look for the listen_port
directive in the configuration file. The listen_port
directive specifies the port number that the vsftpd server will listen on for incoming connections. By default, this directive is set to 21:
listen_port=21
To change the port number, simply edit the value of the listen_port
directive to the port number that you want to use. For example, to use port number 2121, you would set the listen_port
directive like this:
listen_port=2121
Once you have made your changes to the configuration file, save your changes and exit the text editor. Then, restart the vsftpd server to apply the new configuration. You can restart the vsftpd server using the following command:
sudo systemctl restart vsftpd
Keep in mind that you may need to update your firewall rules to allow incoming connections on the new port number. You may also need to update any client software that is configured to connect to the FTP server, as it will need to be pointed to the new port number.