FTP and dot directories

Discussion in 'Cisco/Linksys Network Storage Devices' started by mibukyoshiro, Jul 16, 2008.

  1. mibukyoshiro

    mibukyoshiro Addicted to LI Member


    I'm using jac's firmware (but the problem was the same with the original one) and I'm having issues creating directories beginning with a dot via FTP.

    I could use samba or SCP to send my backups, but using scp I manage to transfer at most at 450ko/s and with samba it never transfer quicker than ~1Mo/s. This is really crappy speed for a 100Mbps net (both NAS and servers are on the same Gbit router) ^^

    Here follows the session log :

    Création du répertoire `.aptitude'
    ---> MKD /DISK 1/backup/2008-07-15/root/.aptitude
    <--- 550 Error: Permission denied.
    ---> CWD /DISK 1/backup/2008-07-15/root/.aptitude
    <--- 451 Error: No such file or directory.
    ---> QUIT
    <--- 221 See you later...
    ---- Fermeture du socket de contrôle

    Is there a way to allow creation of dot dirs on bftpd ?
    How ? :frown:

    Thanks a lot for your help.
  2. mibukyoshiro

    mibukyoshiro Addicted to LI Member

    (sorry I totally forgot :eek: : it's a NAS 200 ^^)
  3. jac_goudsmit

    jac_goudsmit Super Moderator Staff Member Member

    You can fix the problem by changing the current directory to something other than the root directory before doing the MKD command:

    C:\Documents and Settings\Jac>ftp
    Connected to
    220 FTP server at ready.
    User ( jac
    331 Password please.
    230 User logged in.
    ftp> pwd
    257 "/" is the current working directory.
    ftp> mkdir "DISK 1/.aptitude"
    550 Error: Permission denied.
    ftp> cd "DISK 1"
    250 OK
    ftp> mkdir .aptitude
    257 ".aptitude" has been created.
    ftp> quit
    221 See you later...
    The 550 is generated by some code that's added by the Linksys engineers. They added a parsedir.c which is called from almost all commands, to prevent ftp users from getting to essential system files (such as /etc/passwd) and to translate the directory name in the virtual file system ("/DISK 1/.bla") to a real path ("/harddisk/volume_1/data/.bla"). Looks like this module was written pretty sloppily; For example it appears to use "getcwd" (get the current working directory in the real filesystem) to check if the current location in the virtual filesystem is the root directory, and there may also be at least one potential buffer overrun.

    In my mind I hear a sound sample from the old Carmageddon game: "Oh messy!"

  4. mibukyoshiro

    mibukyoshiro Addicted to LI Member

    yuck yuck yuck :eek:
    There's always "nice features" to discover everywhere in the IT world :biggrin:

    Ok so it works now, thanks a lot for the cd tip !

    But now I've just discovered another issue... I'm trying to use lftp's mirror -cvR command to send a full directory+subdirs without re-sending already up to date files.

    When the client tries to create an already existing dir the server reply is :
    ---> CWD /backup/2008-07-15/root
    <--- 250 OK
    ---> MKD .ssh
    <--- 451 Error: The directory name already exists.
    On a standard server, the answer would have been like this :
    ---> MKD tmp
    <--- 550 Create directory operation failed.
    And then lftp would have continued the mirror...

    In fact after reading the FTP RFC, I've seen that 4xx codes are used for temporary errors (so the client tries again), and 5xx codes are permanent errors... So lftp is considering it's a temporary failure and that it should continue until it's either done or in a state of permanent error :thumbdown:

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice