ftpproftpd

error: unable to open /dev/null for stdin: No such file or directory


I cannot get a simple trigger on proftpd working. Here is what I did:

 <IfModule mod_exec.c>
  ExecEngine on
  ExecOptions logStderr logStdout
  ExecLog /var/log/proftpd/exec.log
  ExecOnCommand APPE,STOR /usr/local/bin/proftptest.sh %u %f
 </IfModule>

however it keeps on failing with:

Jan 21 17:31:07 mod_exec/0.9.9[22514]: already saw this Exec, skipping
Jan 21 17:31:07 mod_exec/0.9.9[22514]: already saw this Exec, skipping
Jan 21 17:31:07 mod_exec/0.9.9[22514]: preparing to execute '/usr/local/bin/proftptest.sh' with uid 117 (euid 117), gid 65534 (egid 65534)
Jan 21 17:31:07 mod_exec/0.9.9[22514]:  + '/usr/local/bin/proftptest.sh': argv[1] = ftp
Jan 21 17:31:07 mod_exec/0.9.9[22514]:  + '/usr/local/bin/proftptest.sh': argv[2] = /home/ftp/incoming/Examples.txt
Jan 21 17:31:07 mod_exec/0.9.9[22514]: error: unable to open /dev/null for stdin: No such file or directory
Jan 21 17:31:07 mod_exec/0.9.9[22514]: STOR ExecOnCommand '/usr/local/bin/proftptest.sh' failed: No such file or directory
Jan 21 17:31:07 mod_exec/0.9.9[22514]: already saw this Exec, skipping
Jan 21 17:31:07 mod_exec/0.9.9[22514]: already saw this Exec, skipping

However the script seems fine (running from my user session, default env):

$ ls -al /usr/local/bin/proftptest.sh
-rwxr-xr-x 1 root root 97 Jan 21 17:25 /usr/local/bin/proftptest.sh

I am NOT using DefaultRoot:

$ grep Default /etc/proftpd/proftpd.conf
DefaultServer           on
# DefaultRoot           ~

What could I possibly be missing ?


Solution

  • As expained in the documentation:

    http://www.castaglia.org/proftpd/modules/mod_exec.html#Usage

    This module will not work properly for <Anonymous> logins

    This document the symptoms, but does not solve the real issue, so moving on to a different ftp server...