ProFTPD fails to start with PID file error after manual installation from source

yuer

New Member
Joined
Jan 3, 2025
Messages
6
Reaction score
1
Credits
56
I have been trying to install and configure ProFTPd 1.3.8c on CentOS 7, but when I try to start the service, it fails.
Installation and Configuration Process:
Here's a summary of my installation and configuration steps:

Installing Dependencies:

sudo yum install openssl-devel
cd /home/a/
wget ftp://ftp.proftpd.org/distrib/source/proftpd-1.3.8c.tar.gz
yum install gcc gcc-c++ autoconf automake
tar -xzf proftpd-1.3.8c.tar.gz
cd proftpd-1.3.8c
./configure --prefix=/usr/local/proftpd \
--sysconfdir=/etc/proftpd \
--enable-nls \
--enable-openssl \
--enable-shadow
make
make install

Configuring the Service:

cp contrib/dist/rpm/proftpd.init.d /etc/init.d/proftpd
chmod +x /etc/init.d/proftpd
chkconfig --add proftpd
chkconfig proftpd on

Modifying the Init Script (/etc/init.d/proftpd)
I made the following changes:

# From:
[ ${NETWORKING} = "no" ] && exit 1
# To:
[[ ${NETWORKING} = "no" ]] && exit 1
And later in the script, I changed:

# From:
[ -x /usr/sbin/proftpd ] || exit 5
# To:
[ -x /usr/local/proftpd/sbin/proftpd ] || exit 5
Firewall Configuration:

firewall-cmd --permanent --add-service=ftp
firewall-cmd --reload
Creating FTP User and Group:

groupadd ftpgroup
useradd -g ftpgroup -d /var/ftp -s /sbin/nologin ftpuser

Configuring ProFTPd:
In /etc/proftpd/proftpd.conf, I made the following changes:

User ftpuser
Group ftpgroup
PidFile /run/proftpd/proftpd.pid
TransferLog /var/log/proftpd/transfer.log
SystemLog /var/log/proftpd/syslog.log

Path Setup:

nano ~/.bash_profile
# Add:
export PATH=$PATH:/usr/local/proftpd/sbin
source ~/.bash_profile

Creating Required Directories:

sudo mkdir -p /var/log/proftpd/
sudo mkdir -p /run/proftpd/
sudo chown ftpuser:ftpgroup /run/proftpd/
sudo chmod 755 /run/proftpd/

Issues Encountered:
After performing these steps, I attempted to start the ProFTPd service with the following command:

service proftpd start

But it failed with this message:

vbnet
Copy code
Starting proftpd (via systemctl): Warning: proftpd.service changed on disk. Run 'systemctl daemon-reload' to reload units.
Job for proftpd.service failed because the control process exited with error code. See "systemctl status proftpd.service" and "journalctl -xe" for details.
[FAILED]

I tried running the following commands to troubleshoot:


systemctl status proftpd

The output showed:

● proftpd.service - LSB: ProFTPd FTP Server
Loaded: loaded (/etc/rc.d/init.d/proftpd; bad; vendor preset: disabled)
Active: failed (Result: exit-code) since Fri 2025-01-03 06:39:09 EST; 14s ago
I also checked the logs with journalctl -xe and found the error:

in the log, it says that

error writing PidFile '/run/proftpd/proftpd.pid': No such file or directory

Troubleshooting Attempts:
Ensured Directory Permissions: I created the necessary directories and changed the ownership and permissions:

sudo mkdir -p /run/proftpd/
sudo chown ftpuser:ftpgroup /run/proftpd/
sudo chmod 755 /run/proftpd/

Modified proftpd.service File:
In /home/a/proftpd-1.3.8c/contrib/dist/rpm/proftpd.service, I updated the ExecStart line to ensure the correct binary is used:


ExecStart = /usr/local/proftpd/sbin/proftpd --nodaemon $PROFTPD_OPTIONS
ExecStartPre=/usr/local/proftpd/sbin/proftpd --configtest

Current Status:
The service still fails to start, even after these modifications. The log error message indicates that it still cannot create the PID file in /run/proftpd/.and the log file itself stop to record the activities

My Questions:
Could this issue be related to file system permissions or the user under which ProFTPd is running?
What steps can I take to resolve the PID file creation issue?
Are there any other configuration changes I might be missing that could be preventing ProFTPd from starting?
Thank you for your help!I am using the terminal with the username "a", not "ftpuser", and while I reopen a terminal, the newly added path in $PATH disappear!
EDIT**#################################################**
i have used

echo 'export PATH=$PATH:/usr/local/proftpd/sbin' >> ~/.bashrc
source ~/.bashrc
to better save the $PATH, and change the ftpgroup and ftpuser to the user of sudo, and after restart it again, the logs says that it is

2025-01-03 07:06:17,300 vbox proftpd[19715] vbox: ProFTPD 1.3.8c (maint) (built Fri Jan 3 2025 06:22:03 EST) standalone mode STARTUP
2025-01-03 07:27:11,746 vbox proftpd[21234] vbox: Failed binding to 0.0.0.0, port 21: Address already in use
2025-01-03 07:27:11,746 vbox proftpd[21234] vbox: Check the ServerType directive to ensure you are configured correctly
2025-01-03 07:27:11,746 vbox proftpd[21234] vbox: Check to see if inetd/xinetd, or another proftpd instance, is already using 0.0.0.0, port 21
2025-01-03 07:27:11,746 vbox proftpd[21234] vbox: Unable to start proftpd; check logs for more details
 


It seems like you are mixing a couple of different things here.

Usually init.d and systemd are not the same thing.
You usually don't want to use both an rc.init file and a systemd service file, they will conflict with each other.

Did you enable and start the service?

Code:
systemctl enable proftpd

Code:
systemctl start proftpd


2025-01-03 07:27:11,746 vbox proftpd[21234] vbox: Failed binding to 0.0.0.0, port 21: Address already in use

Code:
netstat -a | grep 21

That will likely make a long list of dozens of processes.
So, you can try this.

Code:
netstat -a | grep 21 | grep -i ftp

lsof -i is also a handy command.

Is something already running on this port?

What is the output of

Code:
systemctl cat proftpd

Is it looking for a different path for the PID file?


 
Last edited:
It seems like you are mixing a couple of different things here.

Usually init.d and systemd are not the same thing.
You usually don't want to use both an rc.init file and a systemd service file, they will conflict with each other.

Did you enable and start the service?

Code:
systemctl enable proftpd

Code:
systemctl start proftpd


2025-01-03 07:27:11,746 vbox proftpd[21234] vbox: Failed binding to 0.0.0.0, port 21: Address already in use

Code:
netstat -a | grep 21

That will likely make a long list of dozens of processes.
So, you can try this.

Code:
netstat -a | grep 21 | grep -i ftp

Is something already running on this port?

What is the output of

Code:
systemctl cat proftpd

Is it looking for a different path for the PID file?
when I type
Code:
systemctl enable proftpd

Code:
systemctl start proftpd
, it says that it still fails, when I type
Code:
netstat -a | grep 21 | grep -i ftp
[code]
it says nothing, and after I check the log, it says that 
[ICODE]2025-01-03 07:06:17,300 vbox proftpd[19715] vbox: ProFTPD 1.3.8c (maint) (built Fri Jan 3 2025 06:22:03 EST) standalone mode STARTUP[/ICODE]
[ICODE]2025-01-03 07:27:11,746 vbox proftpd[21234] vbox: Failed binding to 0.0.0.0, port 21: Address already in use[/ICODE]
[ICODE]2025-01-03 07:27:11,746 vbox proftpd[21234] vbox: Check the ServerType directive to ensure you are configured correctly[/ICODE]
[ICODE]2025-01-03 07:27:11,746 vbox proftpd[21234] vbox: Check to see if inetd/xinetd, or another proftpd instance, is already using 0.0.0.0, port 21[/ICODE]
[ICODE]2025-01-03 07:27:11,746 vbox proftpd[21234] vbox: Unable to start proftpd; check logs for more details[/ICODE]
[ICODE]2025-01-03 07:40:16,120 vbox proftpd[22326] vbox: Failed binding to 0.0.0.0, port 21: Address already in use[/ICODE]
[ICODE]2025-01-03 07:40:16,120 vbox proftpd[22326] vbox: Check the ServerType directive to ensure you are configured correctly[/ICODE]
[ICODE]2025-01-03 07:40:16,120 vbox proftpd[22326] vbox: Check to see if inetd/xinetd, or another proftpd instance, is already using 0.0.0.0, port 21[/ICODE]
[ICODE]2025-01-03 07:40:16,120 vbox proftpd[22326] vbox: Unable to start proftpd; check logs for more details[/ICODE]
[ICODE]2025-01-03 07:42:07,447 vbox proftpd[19715] vbox: ProFTPD killed (signal 15)[/ICODE]
[ICODE]2025-01-03 07:42:07,448 vbox proftpd[19715] vbox: ProFTPD 1.3.8c standalone mode SHUTDOWN[/ICODE]
 
It seems like you are mixing a couple of different things here.

Usually init.d and systemd are not the same thing.
You usually don't want to use both an rc.init file and a systemd service file, they will conflict with each other.

Did you enable and start the service?

Code:
systemctl enable proftpd

Code:
systemctl start proftpd


2025-01-03 07:27:11,746 vbox proftpd[21234] vbox: Failed binding to 0.0.0.0, port 21: Address already in use

Code:
netstat -a | grep 21

That will likely make a long list of dozens of processes.
So, you can try this.

Code:
netstat -a | grep 21 | grep -i ftp

lsof -i is also a handy command.

Is something already running on this port?

What is the output of

Code:
systemctl cat proftpd

Is it looking for a different path for the PID file?


and also the PIDfile in systemctl start proftpd is indeed different from that in the config, and I copy the dir listed in that file and use vi to change that
 
2025-01-03 07:40:16,120 vbox proftpd[22326] vbox: Failed binding to 0.0.0.0, port 21: Address already in use
Something's already active on port 21, you will have to stop whatever is currently active on port 21 before you can start proftpd. Share the output of the following.
Code:
ss -tulpn | grep 21
 
Something's already active on port 21, you will have to stop whatever is currently active on port 21 before you can start proftpd. Share the output of the following.
Code:
ss -tulpn | grep 21
it list nothing...
 
it list nothing...
Try disabling selinux and then starting it, since you are compiling it from source high chance that it's an selinux thing.
Code:
setenforce 0
Then try starting it again.
 
Try disabling selinux and then starting it, since you are compiling it from source high chance that it's an selinux thing.
Code:
setenforce 0
Then try starting it again.
when I type systemctl cat proftpd the dir to the PIDfile in the result file of this command is not the same as the one in the config file, is there any way to change it?I think it is the problem
 
when I type systemctl cat proftpd the dir to the PIDfile in the result file of this command is not the same as the one in the config file, is there any way to change it?I think it is the problem
I'm not sure what you mean?

These.
PidFile /run/proftpd/proftpd.pid
sudo mkdir -p /run/proftpd/
sudo chown ftpuser:ftpgroup /run/proftpd/
sudo chmod 755 /run/proftpd/
And this one.
error writing PidFile '/run/proftpd/proftpd.pid': No such file or directory
Look like the same path?
 
I'm not sure what you mean?

It seems he is using both sysVinit ( rc.init and chkconfig ) as well as systemd service files,
The paths are not the same. He needs to remove one of them.
 
It seems he is using both sysVinit ( rc.init and chkconfig ) as well as systemd service files,
The paths are not the same. He needs to remove one of them.
could you please tell me how to do this
 
Also CentOS7 uses SystemD and not SystemV, so might as well try and writeh a systemd-unit-file for it. The one on CentOS Stream 9 looks like this.
Code:
[Unit]
Description = ProFTPD FTP Server
Wants=network-online.target
After=network-online.target nss-lookup.target local-fs.target remote-fs.target

[Service]
Type = simple
Environment = PROFTPD_OPTIONS=
EnvironmentFile = -/etc/sysconfig/proftpd
ExecStartPre = /usr/sbin/proftpd --configtest
ExecStart = /usr/sbin/proftpd --nodaemon $PROFTPD_OPTIONS
ExecReload = /bin/kill -HUP $MAINPID
PIDFile = /run/proftpd/proftpd.pid

[Install]
WantedBy = multi-user.target
Try place a file in the path under /etc/systemd/system/proftpd.service and adjust the location to your compiled binaries.

Als it might be worth noting that CentOS7 is end of life and you should be using and os that has an active lifecycle. You would probably not have trouble starting it if you installed it using the package manager.
 
It seems he is using both sysVinit ( rc.init and chkconfig ) as well as systemd service files,
If I remember when you use "service" you are automatically redirected to "systemctl".
 
Try place a file in the path under /etc/systemd/system/proftpd.service and adjust the location to your compiled binaries.
That would probably look like this for you.
Code:
[Unit]
Description = ProFTPD FTP Server
Wants=network-online.target
After=network-online.target nss-lookup.target local-fs.target remote-fs.target

[Service]
Type = simple
Environment = PROFTPD_OPTIONS=
EnvironmentFile = -/etc/sysconfig/proftpd
ExecStartPre = /usr/local/proftpd/sbin/proftpd --configtest
ExecStart = /usr/local/proftpd/sbin/proftpd --nodaemon $PROFTPD_OPTIONS
ExecReload = /bin/kill -HUP $MAINPID
PIDFile = /run/proftpd/proftpd.pid

[Install]
WantedBy = multi-user.target
 
And then you could still add User and Group, so then it would look like this.
Code:
[Unit]
Description = ProFTPD FTP Server
Wants=network-online.target
After=network-online.target nss-lookup.target local-fs.target remote-fs.target

[Service]
Type = simple
Environment = PROFTPD_OPTIONS=
EnvironmentFile = -/etc/sysconfig/proftpd
ExecStartPre = /usr/local/proftpd/sbin/proftpd --configtest
ExecStart = /usr/local/proftpd/sbin/proftpd --nodaemon $PROFTPD_OPTIONS
ExecReload = /bin/kill -HUP $MAINPID
PIDFile = /run/proftpd/proftpd.pid
User=ftpuser
Group=ftpgroup

[Install]
WantedBy = multi-user.target
However I think you will then run into trouble that normal users aren't allowed to listen on ports below 1024. So then you would have to make sure your "ftpuser" is a system user if I remember correctly. And don't forget to run "systemctl daemon-reload" after changing the unit file.
 
Reove all of this.

cp contrib/dist/rpm/proftpd.init.d /etc/init.d/proftpd
chmod +x /etc/init.d/proftpd
chkconfig --add proftpd
chkconfig proftpd on

Modifying the Init Script (/etc/init.d/proftpd)
I made the following changes:


chkconfig --add proftpd
chkconfig proftpd on

chkconfig --remove proftpd
chkconfig proftpd off

If I remember when you use "service" you are automatically redirected to "systemctl".

Yes, there is a wrapper to do this, but I still don't think you can have two different configs active
at the same time?
 
Btw, why not just install CentOS Stream 8 or 9, that way you can just use dnf to install proftpd for you without you having to configure anything manually like you are running into issues now when using a compiled from source version? It doesn't seem like a serious installation since you are running it in virtualbox?
 
Last edited:
I did notice the download site defaults to 10 now.
I read somewhere they they are still working on getting EPEL10 packages all done for 10. I wouldn't go to 10 just yet until RHEL10 is actually released then you can be sure that most EPEL10 packages will be available by then.
 

Members online


Top