#From: Peter N Lewis # #Installing anonymous FTP on a Sun workstation (under 4.1.1, 4.1.2) # #NOTE: Please read the warnings at the end. # #1) Create the user ftp in /etc/passwd. Use a misc group. The user`s home #directory will be ~ftp where ~ftp is the root you wish anonymous users to see. Use an invalid password and shell. The entry in the passwd file #should look something like: # #ftp:*:400:400:Anonymous FTP:/home/ftp:/bin/true #2) Run the following script, after modifying it to set the YOU variable to #whoever is going to admin your ftp site (this is used to set the owner of #****** Cut here #!/bin/sh # ## Set YOU to whoever will maintain your ftp site. root is probably a good bet. # Your username is another possibility. ftp is NOT! No directories or files # inside ~ftp should be owned by ftp. YOU=root # No other parameters should need to be changed # Get the UID of YOU YOUUID=`grep "^$YOU:" /etc/passwd | cut -d: -f3` if [ "x" = "x$YOUUID" ]; then echo User $YOU not found exit fi FTPDIR=`grep "^ftp:" /etc/passwd | cut -d: -f6` if [ "x" = "x$FTPDIR" ]; then echo ftp home directory not found exit fi # Find the correct libc.so and libdl.so LIBC=`ls /usr/lib/libc.so.* | tail -1` # The next line will probably error on 4.1.1, that shouldn't matter. LIBDL=`ls /usr/lib/libdl.so.* | tail -1` install -d -o $YOU -g wheel -m 755 $FTPDIR cd $FTPDIR install -d -o root -g wheel -m 555 bin install -o root -g wheel -m 111 /usr/bin/ls bin install -d -o root -g wheel -m 555 dev install -d -o root -g wheel -m 555 etc install -d -o $YOU -g wheel -m 722 install install -d -o $YOU -g wheel -m 755 pub install -d -o root -g wheel -m 555 usr install -d -o root -g wheel -m 555 usr/lib install -o root -g wheel -m 555 /usr/lib/ld.so usr/lib install -o root -g wheel -m 555 $LIBC usr/lib if [ "x" != "x$LIBDL" ]; then install -o root -g wheel -m 555 $LIBDL usr/lib fi install -d -o root -g wheel -m 555 usr/share install -d -o root -g wheel -m 555 usr/share/lib install -d -o root -g wheel -m 555 usr/share/lib/zoneinfo install -o root -g wheel -m 444 /usr/share/lib/zoneinfo/localtime usr/share/lib/zoneinfo mknod dev/zero c 3 12 # NOTE: Do NOT cp /dev/zero dev/zero. The zero device is an endless # sequence of zeros, and it will completely fill your file system! chown root.wheel dev/zero chmod 444 dev/zero echo "wheel:*:0:" >etc/group chown root.wheel etc/group chmod 444 etc/group echo "root:*:0:0:::" >etc/passwd if [ $YOUUID != 0 ]; then echo "ftpadmin:*:$YOUUID:0:::" >>etc/passwd fi chown root.wheel etc/passwd chmod 444 etc/passwd exit #WARNING: Neither the home directory (~ftp) nor any directory below it #should be owned by ftp! Modern ftp daemons support all kinds of useful #commands, such as chmod, that allow outsiders to undo your careful #permission settings. #(Thanks to Wietse Venema for that note!) # #WARNING: If you don't wish to have a place for anonymous users to leave #files, delete the directory ~ftp/incoming. This directory is created #write-only (722), so people can't use your site as a storage place, but #even so you may not want it. # #NOTE: You could save some space and simplify the script by using a #statically linked ls. I tried this and it didn't work for me, but if #someone could get a statically linked ls, and hack the above script to get #rid of the excess baggage, put the two files in an archive and make it #available, that would be good. A statically linked version may be #available from the following sources: #--- #If you want a statically linked "ls" get the GNU fileutils off #a archive site near you and statically link it. #Also, if you have the 4.1.2 or greater OS CD-ROM it has several #statically linked programs on it. You will have #to mount it and look in the upgrade directory. # Rob Montjoy - Rob.Montjoy@UC.Edu #--- #I put a staticaly linked ls in my anonymous ftp: # sasun1.epfl.ch.:pub/ls.412.sun4.static #It is the Sun OS 4.1.1 ls compiled under 4.1.2, no garantees whatsoever, #But I tried it once and it worked :-) #Alain Brossard brossard@sic.epfl.ch # # #Much of the information for the above is in the man page for ftpd. #There are also wrappers and ftpd-replacements available which add #the ability to control access, log accesses, and keep statistical #records of file transfers. Two of these are available on #ftp.uwtc.washington.edu in /pub/Sun_Software as "log_tcp_4.3.shar.Z" #and "ftpd.wuarchive.tar.Z" # #I STRONGLY recomend you get and install log_tcp. You can make your site #far more secure by using this package! # #These instructions were copied directly from Jon Wiederspan's #, and he in turn thanked: # #Bill Unruh #Devendra Narayan #Dan Farmer #Jim Hudgens #Wietse Venema #