[comp.unix.internals] anonymous ftp ?

abrams@.dan.adm.bnl.gov (The Ancient Programmer) (12/27/90)

	I know that comp.unix.wizards is supposed to be defunct, but I'm
not sure where this question belongs otherwise...?....


	I wish to set up an anonymous ftp on my Sun, but am having trouble
implementing  "ls" for user anonymous. I created the user ftp with a home
directory /home/amonymous & with subdirectories pub, bin & etc. I then copied 
/usr/bin/ls into the bin directory and a truncated passwd file and group
file into the etc directory, all of this as per the instructions in Nemeth's
book "Unix System Administratin Handbook".
	When I ftp in as anonymous and try to execute ls, I get the following
response:
200 PORT command successful.
150 ASCII data connection for /bin/ls (130.199.128.111,1047) (0 bytes).
crt0: no /usr/lib/ld.so
226 ASCII Transfer complete.
25 bytes received in 0.02 seconds (1.2 Kbytes/s)

	If create a ~ftp/usr/lib directory and copy /usr/lib/ls.so to it, "ls"
responds with:
200 PORT command successful.
150 ASCII data connection for /bin/ls (130.199.128.111,1049) (0 bytes).
crt0: no /dev/zero
226 ASCII Transfer complete.
20 bytes received in 0.02 seconds (0.98 Kbytes/s)

	I then removed ~ftp/bin altogether and tried "ls" and got:
200 PORT command successful.
150 ASCII data connection for /bin/ls (130.199.128.111,1050) (0 bytes).
226 ASCII Transfer complete.

	If anyone is still reading this news group, can they tell me what 
I'm doing wrong here? I'm running SunOS4.1 on a Sun 3/50.

			Thanks in advance,


INTERNET:  abrams@bnl.gov               |/ |    ^
BITNET:    abrams@bnlux0.BITNET         |\ |__ /-\

jik@athena.mit.edu (Jonathan I. Kamens) (12/29/90)

  I was hoping someone else would respond to your question since I can't claim
to have the first-hand knowledge necessary to answer it (I don't do a lot of
work with Suns), but I've seen the topic discussed at least a couple times
before, so I think I might be able to help.

In article <2379@bnlux0.bnl.gov>, abrams@.dan.adm.bnl.gov (The Ancient Programmer) writes:
|> 	When I ftp in as anonymous and try to execute ls, I get the following
|> response:
|> 200 PORT command successful.
|> 150 ASCII data connection for /bin/ls (130.199.128.111,1047) (0 bytes).
|> crt0: no /usr/lib/ld.so
|> 226 ASCII Transfer complete.
|> 25 bytes received in 0.02 seconds (1.2 Kbytes/s)

  OK, you're missing the shared libraries.  This is the problem I've seen
discussed in the past.  One way to solve it is to compile an ls binary that is
statically linked.  Another way is to do what you did....

|> 	If create a ~ftp/usr/lib directory and copy /usr/lib/ls.so to it, "ls"
|> responds with:
|> 200 PORT command successful.
|> 150 ASCII data connection for /bin/ls (130.199.128.111,1049) (0 bytes).
|> crt0: no /dev/zero
|> 226 ASCII Transfer complete.
|> 20 bytes received in 0.02 seconds (0.98 Kbytes/s)

  I seem to recall that /dev/zero is Sun's version of /dev/null.  If you
create ~ftp/dev and create a "zero" device in it with the same major and minor
device numbers as the /dev/zero in your root filesystem, this problem should
go away.

|> 	I then removed ~ftp/bin altogether and tried "ls" and got:
|> 200 PORT command successful.
|> 150 ASCII data connection for /bin/ls (130.199.128.111,1050) (0 bytes).
|> 226 ASCII Transfer complete.

  Well, this is simply because there's no ls binary for ftp to run, so it
can't print a listing.

  Hope this helps.

-- 
Jonathan Kamens			              USnail:
MIT Project Athena				11 Ashford Terrace
jik@Athena.MIT.EDU				Allston, MA  02134
Office: 617-253-8085			      Home: 617-782-0710

mcr@Latour.Sandelman.OCUnix.On.Ca (Michael Richardson) (12/29/90)

In article <1990Dec28.173122.6421@athena.mit.edu> jik@athena.mit.edu (Jonathan I. Kamens) writes:
>  I seem to recall that /dev/zero is Sun's version of /dev/null.  If you
>create ~ftp/dev and create a "zero" device in it with the same major and minor
>device numbers as the /dev/zero in your root filesystem, this problem should
>go away.

  /dev/zero is just like /dev/null, except that you can read an
infinite number of zeros from it (rather than 0 'infinites' :-)
  It is probably used with a mmap call to get some mapped memory or
something...

  'man zero' tells me:

 "   Mapping a  zero  special  file  creates  a  zero-initialized
     unnamed memory object of a length equal to the length of the
     mapping and rounded up to the nearest page size as  returned
     by getpagesize(2).  Multiple processes can share such a zero
     special file object provided a common  ancestor  mapped  the
     object MAP_SHARED.  "

-- 
   :!mcr!:            |  The postmaster never | - Pay attention only
   Michael Richardson |    resolves twice.    | to _MY_ opinions. -  
 HOME: mcr@sandelman.ocunix.on.ca +   Small Ottawa nodes contact me
 Bell: (613) 237-5629             +    about joining ocunix.on.ca!

guy@auspex.auspex.com (Guy Harris) (01/06/91)

>	I wish to set up an anonymous ftp on my Sun, but am having trouble
>implementing  "ls" for user anonymous.

So take a look at the instructions in the FTPD(8C) manual page on
setting anonymous FTP up; it's in the DESCRIPTION section after the part
on how "ftpd" authenticates users (and right before the DIAGNOSTICS
section).

(This applies to SunOS 4.x.)