Subject: SunOS 4.1.4 DIR problem fixed!

From: Tim Capps <[email-masked]>
Date: Thu, 4 Jan 1996 16:00:22 -0800

Thanks to everyone who helped me finally nail this one down.
Here's what needs to be done in order to make anon FTP work with DIR
under SunOS 4.1.4.  Also, you can define "guestgroup customer" in
your /usr/local/etc/ftpaccess file, and create a group "customer" in /etc/group.
This will allow you to have a class of users who can have their own
secure FTP areas, but can't prowl all over your system.

Here is my directory tree:

~ftp:
total 5
d--x--x--x  2 root           512 Dec  5 14:48 bin
d--x--x--x  2 root           512 Jan  4 14:13 dev
d--x--x--x  2 root           512 Jan  4 15:03 etc
drwxrwxrwx  2 root           512 Nov 28 19:46 pub
d--x--x--x  3 root           512 Jan  4 15:05 usr

~ftp/bin:
total 550
---x--x--x  1 root         24576 Nov 28 15:02 compress
---x--x--x  1 root         90112 Nov 28 18:37 gzip
---x--x--x  1 root         13352 Jan  3 18:55 ls
---x--x--x  1 root        425984 Nov 28 19:16 tar

~ftp/dev:
total 0
crw-rw-rw-  1 root        3,  12 Jan  4 14:13 zero

~ftp/etc:
total 7
-r--r--r--  1 root           299 Nov 28 19:45 group
-rw-r--r--  1 root          4096 Jan  4 14:26 ld.so.cache
-r--r--r--  1 root           151 Nov 28 19:58 motd
-r--r--r--  1 root            71 Nov 28 19:24 passwd

~ftp/pub:
total 0

~ftp/usr:
total 1
d--x--x--x  2 root           512 Dec 28 13:45 lib

~ftp/usr/lib:
total 608
-r-xr-xr-x  1 root         40960 Jan  4 14:11 ld.so
-r-xr-xr-x  1 root        548864 Jan  4 14:11 libc.so.1.9.2
-r-xr-xr-x  1 root         24576 Jan  4 14:11 libdl.so.1.0

To create ~ftp/dev/zero, use: mknod ~ftp/dev/zero c 3 12
You also need to be sure that /etc/ld.so.cache is copied into the ~ftp
tree, as well as the libraries listed above.

After several weeks of working on this on and off, it finally WORKS!!
I did some careful pruning to make sure that there isn't extra flotsam
in the ~ftp tree which isn't really needed.

Here is a little script I whipped up to create FTP trees for customer
use.  Modify the /h/customer reference below for where you keep your
ftp trees.  The ~ftp tree must be kept in the same place for this to work.

----- start script -----

#!/usr/bin/csh
#
# makeftp - create FTP tree for a customer
#
# Syntax: ftp userid
# userid is customer's user ID (must already have been created in /etc/passwd)
#
if ($#argv != 1) then
 echo "Syntax: makeftp userID"
 exit
endif

# validate the user ID
if ! { fgrep $1 /etc/passwd >/dev/null } then
  echo "Invalid user ID - create the user login with vipw first."
  exit
endif

# user ID is valid, clone various parts of the ftp user tree
cd /h/customer
mkdir $1
cp -pr ftp/bin $1
cp -pr ftp/usr $1
cp -pr ftp/etc $1
mkdir $1/dev
mknod $1/dev/zero c 3 12
mkdir $1/data
chown -R $1 $1
chmod o-rw $1
chgrp -R customer $1
chmod og-rw $1/data

---- end script ----

Cheers,
Tim