Find the answer to your Linux question:
Results 1 to 2 of 2
Hi, I'm attempting to set up a Linux-based server to handle our public FTP. This will be replacing a rather overworked Windows box. Our clients mainly use automated FTP scripts ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jun 2006
    Posts
    1

    Question Linux FTP server, Windows Clients: Path Separator Problem


    Hi,

    I'm attempting to set up a Linux-based server to handle our public FTP. This will be replacing a rather overworked Windows box.

    Our clients mainly use automated FTP scripts to supply us with files. I'm aiming to have the Linux server act as a complete 'drop-in' replacement for the Windows box. Key to this, is that I really want to avoid having to ask for changes at the client's end.

    Currently, some of the PUT commands issued by the client will be storing to a path using Windows-style backslash-delimited paths.

    For example, the root of one of our ftp homes may look something like:

    /incoming/
    /misc/

    and the client app may do a PUT as follows (note the backslash)

    PUT C:\SomeFile.Dat incoming\SomeFile.dat

    I've tried a couple of FTP servers. pure-ftpd will see that 'incoming\SomeFile.dat', and fail with an invalid filename error. proftpd creates a file named 'incoming\SomeFile.dat' in the root of the ftp home.

    I need an FTP server daemon which can handle both back- and forward-slash delimited paths. I'm currently trying to toy with proftpd's mod_rewrite module to replace \'s with /'s using a regex, but I'm failing miserably!

    Has anyone got a solution to this? I can't imagine I'm the first to encounter this!

    Thanks,
    Chris

  2. #2
    Just Joined!
    Join Date
    Sep 2006
    Posts
    1
    HI, I have the same problem.

    Here is my solution:

    <IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteLog /var/log/proftpd/rewrite.log
    RewriteMap replace int:replaceall
    RewriteCondition %m STOR|PUT|GET
    RewriteRule ^(.*) "${replace:!$1!\\!\/}"
    </IfModule>

    Here are logs:

    this is win cmd client

    ftp> put d:\admin\proba.txt 341wk00204\proba.txt
    200 PORT command successful
    150 Opening ASCII mode data connection for 341wk00204/proba.txt
    226 Transfer complete


    proftp log files:

    Jun 14 12:44:19: mod_rewrite/0.6.8: rewrite_parse_map_str(): parsing 'STOR'
    Jun 14 12:44:19: mod_rewrite/0.6.8: rewrite_subst(): maps subst'd pattern: 'STOR'
    Jun 14 12:44:19: mod_rewrite/0.6.8: rewrite_match_cond: subst'd cond: 'STOR'
    Jun 14 12:44:19: mod_rewrite/0.6.8: rewrite_match_cond(): checking regex cond
    Jun 14 12:44:19: mod_rewrite/0.6.8: rewrite_fixup(): condition met
    Jun 14 12:44:19: mod_rewrite/0.6.8: rewrite_fixup(): executing RewriteRule
    Jun 14 12:44:19: mod_rewrite/0.6.8: rewrite_subst(): original pattern: '${replace:!$1!\!/}'
    Jun 14 12:44:19: mod_rewrite/0.6.8: rewrite_subst_backrefs(): replacing backref '$1' with '341wk00204\proba.txt'
    Jun 14 12:44:19: mod_rewrite/0.6.8: rewrite_subst(): rule backref subst'd pattern: '${replace:!341wk00204\proba.txt!\!/}'
    Jun 14 12:44:19: mod_rewrite/0.6.8: rewrite_subst(): cond backref subst'd pattern: '${replace:!341wk00204\proba.txt!\!/}'
    Jun 14 12:44:19: mod_rewrite/0.6.8: rewrite_subst(): var subst'd pattern: '${replace:!341wk00204\proba.txt!\!/}'
    Jun 14 12:44:19: mod_rewrite/0.6.8: rewrite_parse_map_str(): parsing '${replace:!341wk00204\proba.txt!\!/}'
    Jun 14 12:44:19: mod_rewrite/0.6.8: rewrite_subst_maps(): map name: 'replace'
    Jun 14 12:44:19: mod_rewrite/0.6.8: rewrite_subst_maps(): lookup key: '!341wk00204\proba.txt!\!/'
    Jun 14 12:44:19: mod_rewrite/0.6.8: rewrite_subst_maps(): default value: ''
    Jun 14 12:44:19: mod_rewrite/0.6.8: rewrite_subst_maps(): mapping '!341wk00204\proba.txt!\!/' using 'replace'
    Jun 14 12:44:19: mod_rewrite/0.6.8: rewrite_map_int_replaceall(): actual key: '341wk00204\proba.txt'
    Jun 14 12:44:19: mod_rewrite/0.6.8: rewrite_map_int_replaceall(): replacing '\' with '/'
    Jun 14 12:44:19: mod_rewrite/0.6.8: rewrite_subst_maps(): internal map 'replace' returned '341wk00204/proba.txt'
    Jun 14 12:44:19: mod_rewrite/0.6.8: rewrite_subst_maps(): substituting '341wk00204/proba.txt' for '${replace:!341wk00204\proba.txt!\!/}'
    Jun 14 12:44:19: mod_rewrite/0.6.8: rewrite_parse_map_str(): parsing ''
    Jun 14 12:44:19: mod_rewrite/0.6.8: rewrite_subst(): maps subst'd pattern: '341wk00204/proba.txt'
    Jun 14 12:44:19: mod_rewrite/0.6.8: rewrite_fixup(): STOR arg now '341wk00204/proba.txt'


    and transfer log

    Mon Jun 14 12:44:19 2010 0 FA2105B-6.tu-sofia.bg 12 /home/banata/341wk00204/proba.txt a _ i r banata ftp 0 * c

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •