A
A
Anton B2015-05-12 20:55:06
Debian
Anton B, 2015-05-12 20:55:06

How to make proftpd + mod_exec work?

Good afternoon.
ProFTPD Version 1.3.4a
mod_exec/0.9.11
Config

<IfModule mod_exec.c>
    ExecEngine on
    ExecLog /var/log/proftpd/exec.log
    ExecOnConnect /var/www/site/data/sh/ftp.sh %u
    ExecOnCommand STOR /var/www/site/data/sh/ftp.sh %u
</IfModule>

Logs
preparing to execute '/var/www/site/data/sh/ftp.sh' with uid 109 (euid 109), gid 65534 (egid 65534)
+ '/var/www/site/data/sh/ftp.sh': argv[1] =
'/var/www/site/data/sh/ftp.sh' terminated normally, with exit status 0
ExecOnConnect '/var/www/site/data/sh/ftp.sh' succeeded

preparing to execute '/var/www/site/data/sh/ftp.sh' with uid 500 (euid 500), gid 500 (egid 500)
 + '/var/www/site/data/sh/ftp.sh': argv[1] = user
error: unable to open /dev/null for stdin: No such file or directory
'/var/www/site/data/sh/ftp.sh' terminated normally, with exit status 2
STOR ExecOnCommand '/var/www/site/data/sh/ftp.sh' failed: No such file or directory

Problem
As you can see from the logs, mod_exec works, but if it executes the ExecOnConnect directive on its own behalf and everything works, then it executes the ExecOnCommand directive on behalf of the FTP user and nothing works.
The problem is solved by removing the DefaultRoot ~ setting from proftpd.conf, but in this case, FTP users get access to the entire file system.
Is there a way to solve my problem without removing the DefaultRoot~? Maybe through links?
* The root directory of the FTP users is /var/www/site/data/
** I've scoured the internet, everyone has a "don't use ProFTPD" solution
Thanks for your attention!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
rgb000, 2017-11-26
@rgb000

Hello. I ran into exactly the same problem recently. Due to the fact that jail is installed on the home folder for each user (DefaultRoot) - the module cannot access the system environment. And this is freely solved by installing the additional mod_vroot module. Details can be viewed here

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question