Ubuntu Linux Tips and Tricks

Some tips for Ubuntu Desktop LTS users

ProFTPD: cannot start neither in standalone nor in inetd/xinetd mode

Leave a comment

For what I can remember it has always been possible to simply do a: apt-get install proftpd to get a working FTP server. It seems that starting with 12.04, it is not all that simple anymore. Well, it might be a bug too.

After installing proftpd on 12.04 (the package is now called proftpd-basic) you’ll be unable to start the service. I’ve tried it both as standalone and using inetd but neither would work. ProFTPD, or rather its init.d script will report:ProFTPD warning: cannot start neither in standalone nor in inetd/xinetd mode

Looking at the syslog I found the following message when trying to connect to the FTP server: error: cannot execute /usr/sbin/in.ftpd: No such file or directory. It turns out that this path is defined in /etc/inetd.conf and for Ubuntu 12.04 it appears that the proftpd-basic package doesn’t install these.

If you don’t have the FTP service defined in inetd/xinetd it simply rejects any connection, giving less helpful error messages. So the fix to this problem is rather easy:

apt-get install openbsd-inetd

And create /etc/inetd.conf (regardless if you use inetd or xinetd). Then, simply add the following line, or replace the existing one with the following:

ftp stream tcp nowait root /usr/sbin/tcpd /usr/sbin/proftpd

Then, restart inetd/xinetd:
/etc/init.d/openbsd-inetd restart

In my setup, I have done this to setup one FTP user, aka “userftp”:
mkdir FTP-shared
useradd userftp -d /home/FTP-shared -s /bin/false
passwd userftp
cd FTP-shared/
mkdir download
mkdir upload
cd ..
sudo chmod 755 FTP-shared
cd FTP-shared
sudo chmod 755 download
sudo chmod 777 upload

I have then saved the contents of /etc/proftpd/proftpd.conf and replaced it with my own configuration options:

AllowOverwrite on
AuthAliasOnly on

ServerName "MYSERVER"
ServerType inetd
DeferWelcome on

MultilineRFC2228 on
DefaultServer on
ShowSymlinks off

TimeoutNoTransfer 600
TimeoutStalled 100
TimeoutIdle 2200

DisplayChdir .message
ListOptions "-l"

RequireValidShell off

TimeoutLogin 20

RootLogin off

# For debugging:
ExtendedLog /var/log/ftp.log
TransferLog /var/log/xferlog
SystemLog /var/log/syslog.log

#DenyFilter \*.*/

# I don't choose to use /etc/ftpusers file
UseFtpUsers off

# Allow to restart a download
AllowStoreRestart on

# Port 21 is the standard FTP port
Port 21

MaxInstances 8

# Set the user and group that the server normally runs at.
User nobody
Group nogroup

# Umask 022 is a good standard umask to prevent new files and dirs
# (second parm) from being group and world writable.
Umask 022 022

PersistentPasswd off

MaxClients 8
MaxClientsPerHost 8
MaxClientsPerUser 8
MaxHostsPerUser 8

# Display a message after a successful login
AccessGrantMsg "welcome !!!"
# This message is displayed for each access good or not
ServerIdent on "you're at home"

# Lock all the users in home directory
DefaultRoot ~

MaxLoginAttempts 5

<Limit LOGIN>
AllowUser userftp


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s