In Linux we have various protocols that give us the possibility of carrying out administrative, communication and many other tasks..
One of these, known to all, is the FTP (File Transfer Protocol) protocol through which we can make transfers between several computers.
A good security practice is to modify the default FTP port to prevent attackers from accessing it, today we will see how to achieve it..
To keep up, remember to subscribe to our YouTube channel! SUBSCRIBE
Modify port 21 by default FTP of Linux
Step 1
To modify the default port of the Proftpd service on Linux, we must open the main Proftpd configuration file to edit the desired editor like this:
sudo nano /etc/proftpd.conf (CentOS and RedHat) sudo nano /etc/proftpd/proftpd.conf (Debian and Ubuntu)
Step 2
When accessing this file, we will locate the “Port†line and see that the default port (21) is:
Step 3
There it is enough to edit the port for which we want, in this case 7777:
Step 4
We save the changes using the following key combination:
+ O Ctrl + O
We leave the editor using:
+ X Ctrl + X
Note
In case of not having proftpd we can install it using the following command:
sudo apt install proftpd-basic
Step 5
In the case of RedHat or CentOS the line will be called "Port 21". Once this step is done, we will execute the following.
systemctl restart proftpd
- Check that the new port is the one assigned:
netstat -tlpn | grep ftp
ss -tlpn | grep ftp
Step 6
In the case of CentOS or RedHat we will use the following lines:
yum install policycoreutils week port -a -t http_port_t -p tcp 2121 week port -m -t http_port_t -p tcp 2121 systemctl restart proftpd
It's that simple to change the FTP port on Linux and improve security.