ftpserver has failed but it works

vexx

Member
May 1, 2012
17
2
53
cPanel Access Level
Root Administrator
Ok so I changed the default port of my pure-ftp server from 21 to xx. Edited both /etc/pureftpd.conf and /etc/chkserv.d/ftpd with that port. Trying to log onto the FTP with that port, works perfectly, for any account I register from WHM. However, I keep getting emails on my admin email that the ftpserver failed. I tried to restart the FTP server from WHM and I keep getting the same error:

Waiting for ftpserver to restart.........finished.

pure-ftpd (pure-ftpd (SERVER)) running as root with PID 3760 (process table check method)
pure-authd (/usr/sbin/pure-authd -s /var/run/ftpd.sock -r /usr/sbin/pureauth) running as root with PID 3762 (pidfile check method)

ftpserver has failed, please contact the sysadmin.
I don't understand why is this happening since the FTP server actually works. What have I done wrong?
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,258
463
Hello :)

Chkservd is not designed to consider a non-standard port when monitoring the FTP service. You would need to disable monitoring for FTP to keep it from restarting at every service check. Feel free to open a feature request that would allow Chkservd to monitor FTP on alternate ports:

Submit A Feature Request

Thank you.
 

sardelich

Well-Known Member
Apr 28, 2010
72
1
58
so other than disabling service check there is no way to change port and have it monitored?
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
43
348
somewhere over the rainbow
cPanel Access Level
Root Administrator
Hello,

It is possible to have it monitored. It isn't possible to have the default ftpd process monitored on the new port, but you can make it into ftpdnew and have that monitored. The reason you cannot do this is that anytime you restart chkservd, it will overwrite port changes you make to /etc/chkserv.d/ftpd file.

Now first, before we get into that, please note that you cannot revise /etc/pure-ftpd.conf file directly. Anytime you make changes in WHM > FTP Server Configuration area, it'll wipe the changes you made. You'd need to instead add the following line to /var/cpanel/conf/pureftpd/main file:

Code:
Bind: 0.0.0.0,Port#
Replace Port# with the port you've used such as 41. This is how we determine what you'll be placing into the pure-ftpd.conf file. The 0.0.0.0 represents all IPs.

After that, try resaving WHM > FTP Server Configuration area to see that it sticks. If it does, then next follow these steps to monitor ftpdnew rather than ftpd (and you can uncheck ftpd at that point for monitoring):

Code:
cd /etc/chkserv.d/
cp ftpd ftpdnew
In ftpdnew file, replace the first ftpd with ftpdnew and replace port 21 with the new port number. Replace %service_auth_user% and %service_auth_pass% with a cPanel user and password, since the typical service password authentication checks in /var/cpanel/serviceauth won't work any longer. It would look something like the following:

Code:
service[ftpdnew]=41,QUIT,220,/usr/local/cpanel/scripts/restartsrv_ftpserver,proftpd||pure-ftpd&&pure-authd,root|nobody,220|USER username|3|PASS password|2|QUIT
Where 41 is the new example port, username is the cPanel username, and password is the cPanel password. Create a dummy test FTP account if needed for this username and password combination.

Next, edit /etc/chkserv.d/chkservd.conf file to add ftpdnew:1 to it (to indicate it should be monitored).

Finally, create a file at /var/run/chkservd/ called ftpdnew:

Code:
echo "+" > /var/run/chkservd/ftpdnew
After that, go to WHM > Service Manager and uncheck ftpd and ensure ftpdnew is checked for enabled and monitor.

This does work for me. It might be a lot of steps, but you'd still at least have some form of monitoring happening.

Thanks!