SOLVED FTP port resetting to default port 21

PeteS

Well-Known Member
Jun 8, 2017
303
66
78
Oregon
cPanel Access Level
Root Administrator
I use a non-standard FTP port on all my servers. Let's use 6021 as an example. I have all my FTP clients configured to that port as well.

I recently set up two new servers. I changed the bind in the FTP config file to 6021 and I opened port 6021 in the firewall and restarted both. I verified from the command line by catting the config file and running the firewall port status command that both were good.

Later I couldn't FTP to one of the servers. On checking I saw bind was port 21 on both servers! I decided I must have forgotten to edit the config files (even though I remembered checking that). So I edited the config files, restarted the FTP service, and all was well.

A couples days later, the same thing happened, on BOTH servers. Their FTP port was back on 21! This time I KNOW it had been set to 6021 because I could FTP. I reset them to 6021 again and all was well again.

I do know that both servers had been restarted between incident 1 and 2, but I can't say that was true between the initial bind change and the first incident. A restart should not have changed anything anyway, but is was shortly after the restarts that I noticed.

Does anyone know of anything that could do this? Am I losing it?! LOL I wondered if some cPanel script might reset it under some circumstance, but I don't what that would be, nor does it seem likely. It's just weird...

-Pete
 

ffeingol

Well-Known Member
PartnerNOC
Nov 9, 2001
713
280
363
cPanel Access Level
DataCenter Provider
Here is cPanel's doc for setting up passive FTP: How to Enable FTP Passive Mode | cPanel & WHM Documentation While I know that's not what you want to do, it gives you documentation as to how to set the parameter and put that into the config that cPanel uses. If you don't do it that what cPanel will (I don't know under what circumstances) rebuild the config and wipe out hour changes.

Hopefully that gets you on the right track.
 
  • Like
Reactions: PeteS

PeteS

Well-Known Member
Jun 8, 2017
303
66
78
Oregon
cPanel Access Level
Root Administrator
@PeteS
You changed the port in /var/cpanel/conf/pureftpd/local ?
DOHT!! Nope, in /etc/pure-ftpd.conf and that seemed wrong to me, but it was in my server customize docs that have been in use for years! I was expecting a local file override but went against my better judgement. (Apparently that setting in my docs never got corrected from yours ago when I encountered this, which I now remember happening.) I SHOULD have googled cPanel docs to confirm, because sure enough: https://support.cpanel.net/hc/en-us/articles/1500000487261-How-to-change-the-FTP-port-for-PureFTPd The override in in /var/cpanel/conf/pureftpd/local

Thanks to both of you... sometimes ya just get going down the wrong track and don't look back. lol

-Pete
 
  • Like
Reactions: cPRex
Feb 14, 2022
5
2
3
North Macedonia
cPanel Access Level
Website Owner
If you are editing the following config file:

/var/cpanel/conf/pureftpd/main

It is absolutely normal to have the port reverted back to the default setting, because whenever the cPanel update is run - it will reset it back to the default settings.
If you would like to override the default configuration and make sure that it will last even after updates, etc, you should edit the following file instead: /var/cpanel/conf/pureftpd/local

Certainly, your web host should be able to help you with such configurations.
 

PeteS

Well-Known Member
Jun 8, 2017
303
66
78
Oregon
cPanel Access Level
Root Administrator
If you are editing the following config file:

/var/cpanel/conf/pureftpd/main

It is absolutely normal to have the port reverted back to the default setting, because whenever the cPanel update is run - it will reset it back to the default settings.
If you would like to override the default configuration and make sure that it will last even after updates, etc, you should edit the following file instead: /var/cpanel/conf/pureftpd/local

Certainly, your web host should be able to help you with such configurations.
Wasn't editing /var/cpanel/conf/pureftpd/main (wrong file)
Wasn't editing /var/cpanel/conf/pureftpd/local (unfortunately)
Was editing /etc/pure-ftpd.conf (wrong file)

I was using incorrect docs (my fault) but once I sorted that out and edited /var/cpanel/conf/pureftpd/local it works as desired.

-Pete