ftpd does not do dir - Minix

This is a discussion on ftpd does not do dir - Minix ; ftpd can do "cd" and "get" OK. but it fails doing "dir". anyone has a fix to this?...

+ Reply to Thread
Results 1 to 15 of 15

Thread: ftpd does not do dir

  1. ftpd does not do dir

    ftpd can do "cd" and "get" OK. but it fails doing "dir". anyone has a
    fix to this?


  2. Re: ftpd does not do dir

    Does this happen on every server that you connect to?

    Ben

    On 2007-01-28, karel wrote:
    > ftpd can do "cd" and "get" OK. but it fails doing "dir". anyone has a
    > fix to this?
    >


  3. Re: ftpd does not do dir



    ftpd is a server


  4. Re: ftpd does not do dir

    Hello,

    > ftpd can do "cd" and "get" OK. but it fails doing "dir". anyone has a
    > fix to this?


    Yes: Use "ls" instead.

    Regards,
    Sebastian



  5. Re: ftpd does not do dir



    ftpd cannot do "ls" too.


  6. Re: ftpd does not do dir

    Hello,

    > ftpd cannot do "ls" too.

    Then something is very wrong.

    If you type "dir" (uncommon) or "ls" in the client, it sends a LIST-request
    to the server, which then runs "/bin/ls" inside the directory you want to
    have the listing of. This output is taken and put onto the network. If the
    LIST-command fails, the server is to blame.

    Either it cannot run /bin/ls because the file doesn't exist (1) or - more
    possible - you instructed the server somehow to chroot into that directory
    (2). Another problem might be the permissions (3).

    (1) I don't think this is the case, as this would require work and possibly
    a re-installation (if "ls" is missing, it's possible that the whole system
    is corrupted).

    (2) Inside the base path of your ftp server, create a directory bin and copy
    /bin/ls there (or do a hard-link). Change the ownership to the same user and
    group, as the ftp server runs (e.g. "ftp") and the permissions to +x. Try to
    execute this ls directly. If that fails, you might try to copy /bin/sh into
    that directory, too, and then do a chroot yourself.

    (3) Make sure that /bin/ls is executable (+x) for everyone, including the
    ftp server's user account.

    I'd be interested what worked - or if it didn't work.

    Regards,
    Sebastian



  7. Re: ftpd does not do dir



    The ls command is done through call to shell script ftpdsh. Have a
    look at the ftpdsh. This script gets executed from
    /usr/src/commands/ftpd200/file.c around line 595. There is a fork and
    execve that is supposed to execute the script.
    I have modified the shell script ftpdsh to report to /tmp/, but the
    execve and subsequent call to ftpdsh never happens.
    In file.c is a test of uninitialized fs[0] and fs[1] and some calls to
    dup2() which I do not understand.

    Do You have ftpd working ?

    Karel


  8. Re: ftpd does not do dir

    Hello,

    > The ls command is done through call to shell script ftpdsh. Have a
    > look at the ftpdsh. This script gets executed from
    > /usr/src/commands/ftpd200/file.c around line 595. There is a fork and
    > execve that is supposed to execute the script.


    I have not (yet) looked at the code, but I described it the way I am told it
    works. If it doesn't on Minix, I can't much help. C is some strange language
    to me, although I am familiar with programming in general.

    In my setup I have no ftpdsh, neither the path you described. As far as I
    can tell the ftpd sources reside at /usr/src/commands/ftpd/ on my system.

    > I have modified the shell script ftpdsh to report to /tmp/, but the
    > execve and subsequent call to ftpdsh never happens.
    > In file.c is a test of uninitialized fs[0] and fs[1] and some calls to
    > dup2() which I do not understand.


    > Do You have ftpd working ?


    Yes, but on Minix 2.0.4 (i286) without any updates.

    I compiled a kernel for my system using the NE2000 driver and put "eth0
    DP8390 0 { default; };" in /etc/inet.conf. Afterwards, I changed the
    /etc/resolv.conf and put then the following in /etc/rc.net:

    ifconfig -h 192.168.2.111 -n 255.255.255.0
    add_route -g 192.168.2.1 -m 25
    daemonize nonamed
    daemonize tcpd telnet in.telnetd
    daemonize tcpd ftp in.ftpd

    Now everything works and I can ftp to my Minix machine on the local network.

    Did you try out what I described?

    Regards,
    Sebastian



  9. Re: ftpd does not do dir


    I am on Minix3 3.1.2a that I got from minix3.org. I am on PentiumIII
    500MHz.
    The ftpd is release 2.0 2005-02-25

    Quote from README in /usr/src/commands/ftpd200/README:
    Release 2.00 incorporates an "improved" machanism to restrict
    execution of commands on the server.
    This is done through use of shell script ftpdsh.
    ASW 2005-02-06

    Questions:
    Who is ASW
    How can I get the older version without the ftpdsh security?


  10. Re: ftpd does not do dir



    The current version of MINIX 3 (3.1.2) is a work in progress. It is
    nowhere near as mature as FreeBSD or Linux right now.


  11. Re: ftpd does not do dir

    ASW is probably Andrew Woodhull, roughly. I believe he posted here within
    the last few days, so you might be able to find the name by looking among
    recent posts. If not, try google.

    He had some trouble with people corrupting an ftp server a year or so ago
    and evidently made some changes.

    Hul

    karel wrote:

    > I am on Minix3 3.1.2a that I got from minix3.org. I am on PentiumIII
    > 500MHz.
    > The ftpd is release 2.0 2005-02-25


    > Quote from README in /usr/src/commands/ftpd200/README:
    > Release 2.00 incorporates an "improved" machanism to restrict
    > execution of commands on the server.
    > This is done through use of shell script ftpdsh.
    > ASW 2005-02-06


    > Questions:
    > Who is ASW
    > How can I get the older version without the ftpdsh security?



  12. Re: ftpd does not do dir

    On Jan 28, 6:50 pm, d...@kbrx.com wrote:
    > ASW is probably Andrew Woodhull, roughly.


    Close -- it's wierd enough that my initials are so similar to AST's
    but my first name is Albert, not Andrew.

    Please do not use an older version of ftpd. There is a serious
    security problem. The latest version is available on my site at
    http://minix1.woodhull.com/pub/contrib/ftpd200.tar.Z.
    (for more info read
    http://minix1.woodhull.com/pub/contrib/ftpd200.txt
    before downloading).

    Ftpd version 2.00 is good for Minix 2.0.4 (and probably earlier
    releases) as well as Minix 3. It should also be included with the
    Minix 3 release, but may not be part of the default binary
    installation.

    > He had some trouble with people corrupting an ftp server a year or so ago
    > and evidently made some changes.


    I don't deserve this credit. Yes, I discovered there was a problem,
    but I got a lot of help from Kees Bot in figuring out what had
    happened, and the fixes were made by Michael Temari, the author of the
    program and a number of other Minix network clients and servers.

    With regard to the original problem of not being able to get directory
    listings: when ftpd is set up for anonymous operation it does a chroot
    operation when activated, so its effective root directory is the ftp
    home directory -- it cannot access any files in directories that are
    not part of the tree rooted there. This means that the ordinary binary
    for ls in /bin/ls or /usr/bin/ls (which is also what is activated for
    the dir command) cannot be used -- there must be a copy of ls as ~ftp/
    bin/ls. The ~ftp/bin directory also may contain other files, for
    instance tar and compress if the ftp server is to do on-the-fly
    creation of compressed tar archives. Similarly, a chrooted ftpd needs
    simplified group and passwd files in ~ftp/etc and for Minix, at least,
    the device file ~ftp/dev/tcp must be present.

    There is documentation of all of this in the ftpd200 package. There is
    also an ftpd.8 man page. In checking this I noted that the on-line
    html version of the ftpd.8 man page at
    http://minix1.woodhull.com/current/2...n8/ftpd.8.html
    is not up-to-date, there is a newer one in the ftpd200 package.

    - Al


  13. Re: ftpd does not do dir



    When I try to run ftpd from the binary that comes with minix 3 v1.2a I
    get following:
    1) "cd pub" works OK
    2) "pwd" works OK
    3) "ls" replies like this:
    150 File NLST okay. Opening data connection.
    Child listener timed out
    425-Could not open data connection.
    425 Could not open tcp_device. Error No such file or directory.
    ftp>

    Can anyone put light on thhis problem?

    Karel


  14. Re: ftpd does not do dir



    I can now connect to ftpd200 on minix3. I am using as a client
    SmartFTP on windows XP.
    It does:
    LIST -aL

    minix replies:

    125 File LIST okay. Opening data connection.

    SmartFTP says:

    0 bytes transferred. (0 bytes/s) (15 ms)
    226 Transfer finished successfully. 0.00 KB/s
    NOOP

    minix replies:

    200 NOOP to you too!

    This all indicates that my original investigation was correct. ls on
    minix never gets executed due to
    the fact that the ftpdsh script never gets done. ftpdsh never gets
    done due to the fact that the execve in
    /usr/src/commands/ftpd200/file.c around line 595 never gets done.
    There is something strange happening
    in file.c like test of unintialized local variables like if(pipe(fds))
    while fds is int fds[2] etc.


  15. Re: ftpd does not do dir

    Sorry for the pipe() botch. I now know it's OK. I got the ftpd going
    using ftpd1.0
    (not recomended for new designs for security reasons). I am only
    experimenting.
    When it comes to ftpd2.0 I modified ftpdsh to start with:
    #!/bin/sh
    echo "ftpdsh" $1 $2 >>/tmp/ftpdsh.log
    date >> /tmp/ftpdsh.log

    there is no /tmp/ftpdsh.log created after doing "dir".

    Karel


+ Reply to Thread