Subject: Neey your help

From: Gary Hull <[email-masked]>
Date: Fri, 28 Feb 1997 13:34:45 -0500 (EST)

I am setting up the wu-ftpd (2.4) running on a sun solaris 2.5.1.  Access is
limited to specific users both from inside our domain as well as from 
outside.  THe inside users can only ftp through our firewall.  I want to
set it up so that each outsdie user is chrooted into their directory.  If
I make the chroot directory the /ftp path, everything works fine, but when
I make the chroot directory the full path for the each users directory
I can not get my data port set up.  I always see the following messages:

ftp> dir
425 Can't open passive connection: No such file or directory.
200 PORT command successful.
425 Can't create data socket (0.0.0.0,20): Bad file number.

Can anyone help?  What am I doing wrong and what can I do to resolve this
problem.  THanks in advance.

			       |/
			---o0o-@@-o0o---------

		Gary G. Hull - Technical Consultant
		Howard Systems International - Glaxo Wellcome Inc. 
		Five Moore Drive - Raleigh, North Carolina  27709
		Tel : (919) 941-4867 - Fax : (919) 483-0056 
		email: [email-masked]

---

From: Mike Farace <[email-masked]>
Date: Fri, 28 Feb 1997 12:00:25 -0800

>                 email: [email-masked]

Sound like you need to run the script for setting up solaris anonymous
FTP.  It creates abunch of device files for you in your ftp directory.

It may be in the Solaris 2.x FAQ, but here it is.  I found it on a man
of ftpd on a Solaris 2.5 system, but didn't find it on my solaris 2.5.1
system...

Here is it.. 

Mike Farace
[email-masked]
=================
     #!/bin/sh
     # script to setup anonymous ftp area
     #
     # handle the optional command line argument
     case $# in

        # the default location for the anon ftp comes from the passwd
file
        0) ftphome="`grep '^ftp:' /etc/passwd | cut -d: -f6`"
           ;;

        1) if [ "$1" = "start" ]; then
              ftphome="`grep '^ftp:' /etc/passwd | cut -d: -f6`"
           else
              ftphome=$1
           fi
           ;;

        *) echo "Usage: $0 [anon-ftp-root]"
           exit 1
           ;;
     esac

     if [ -z "${ftphome}" ]; then
        echo "$0: ftphome must be non-null"
        exit 2
     fi

     # This script assumes that ftphome is neither / nor /usr so ...
     if [ "${ftphome}" = "/" -o "${ftphome}" = "/usr" ]; then
        echo "$0: ftphome must not be / or /usr"
        exit 2
     fi

     # If ftphome does not exist but parent does, create ftphome
     if [ ! -d ${ftphome} ]; then
         # lack of -p below is intentional
         mkdir ${ftphome}
     fi
     echo Setting up anonymous ftp area ${ftphome}

     # Ensure that the /usr/bin directory exists
     if [ ! -d ${ftphome}/usr/bin ]; then
         mkdir -p ${ftphome}/usr/bin
     fi

     cp /usr/bin/ls ${ftphome}/usr/bin
     chmod 111 ${ftphome}/usr/bin/ls

     # Now set the ownership and modes to match the man page
     chown root ${ftphome}/usr/bin
     chmod 555 ${ftphome}/usr/bin

     # this may not be the right thing to do
     # but we need the bin -> usr/bin link
     if [ -r ${ftphome}/bin ]; then
         mv -f ${ftphome}/bin ${ftphome}/Obin
     fi
     ln -s usr/bin ${ftphome}

     # Ensure that the /usr/lib and /etc directories exist
     if [ ! -d ${ftphome}/usr/lib ]; then
         mkdir -p ${ftphome}/usr/lib
     fi
     if [ ! -d ${ftphome}/etc ]; then
         mkdir -p ${ftphome}/etc
     fi

     #Most of the following are needed for basic operation, except
     #for libnsl.so, nss_nis.so, libsocket.so, and straddr.so which are
     #needed to resolve NIS names.

     cp /usr/lib/ld.so /usr/lib/ld.so.1 ${ftphome}/usr/lib

     for lib in libc libdl libintl libw libnsl libsocket \
        nss_nis nss_nisplus nss_dns nss_files
     do
        cp /usr/lib/${lib}.so.1 ${ftphome}/usr/lib
        rm -f ${ftphome}/usr/lib/${lib}.so
        ln -s ./${lib}.so.1 ${ftphome}/usr/lib/${lib}.so
     done

     cp /usr/lib/straddr.so.2 ${ftphome}/usr/lib
     rm -f ${ftphome}/usr/lib/straddr.so
     ln -s ./straddr.so.2 ${ftphome}/usr/lib/straddr.so

     cp /etc/passwd /etc/group /etc/netconfig ${ftphome}/etc

     # Copy timezone database
     mkdir -p ${ftphome}/usr/share/lib/zoneinfo
     (cd ${ftphome}/usr/share/lib/zoneinfo
       (cd /usr/share/lib/zoneinfo; find . -print | cpio -o) | cpio
-imdu
       find . -print | xargs chmod 555
       find . -print | xargs chown root
     )

     chmod 555 ${ftphome}/usr/lib/*
     chmod 444 ${ftphome}/etc/*

     # Now set the ownership and modes
     chown root ${ftphome}/usr/lib ${ftphome}/etc
     chmod 555 ${ftphome}/usr/lib ${ftphome}/etc

     # Ensure that the /dev directory exists
     if [ ! -d ${ftphome}/dev ]; then
         mkdir -p ${ftphome}/dev
     fi

     # make device nodes. ticotsord and udp are necessary for
     # 'ls' to resolve NIS names.

     for device in zero tcp udp ticotsord
     do
        line=`ls -lL /dev/${device} | sed -e 's/,//'`
        major=`echo $line | awk '{print $5}'`
        minor=`echo $line | awk '{print $6}'`
        rm -f ${ftphome}/dev/${device}
        mknod ${ftphome}/dev/${device} c ${major} ${minor}
     done

     chmod 666 ${ftphome}/dev/*

     ## Now set the ownership and modes
     chown root ${ftphome}/dev
     chmod 555 ${ftphome}/dev

     if [ ! -d ${ftphome}/pub ]; then
        mkdir -p ${ftphome}/pub
     fi
     chown ftp ${ftphome}/pub
     chmod 777 ${ftphome}/pub

---

From: Michael Brennen <[email-masked]>
Date: Fri, 28 Feb 1997 14:33:39 -0600 (CST)

FAQ -- see below.

   -- Michael

> 425 Can't create data socket (0.0.0.0,20): Bad file number.

This is the location for the latest wu-ftpd.  You can't see the
directory contents, but get the file anyway.  It's there.

ftp://ftp.academ.com/pub/wu-ftpd/private/wu-ftpd-2.4.2-beta-12.tar.Z

wu-ftpd FAQ:  http://www.cetis.hvu.nl/~koos/wu-ftpd-faq.html
              OR
              send mail to [email-masked]
              with a subject line: send faq

guest howto:  ftp://ftp.fni.com/pub/wu-ftpd/guest-howto
              OR
              send mail to "[email-masked]"
              (immediate autoresponder; subject does not matter)

wu-ftpd list archive:  http://www.landfield.com/wu-ftpd/mail-archive/

There are additional security references in the above docs.