Why use pwd(1) for getpwd(3C)? (Re: Why use find?)

John Cowan cowan at marob.masa.com
Fri Oct 12 03:01:11 AEST 1990


In article <14976 at hydra.gatech.EDU> gt0178a at prism.gatech.EDU (Jim Burns) writes:
>in article <1990Oct10.231857.11668 at virtech.uucp>, cpcahil at virtech.uucp (Conor P. Cahill) says:
>> I don't know the reason for making it a call to popen(),  one reason may
>> have been security (pwd could be a setuid pgm and do things that a 
>> function call couldn't).
>
>Not on my system (see below). And what about those shells that have pwd
>builtin? My shell's pwd seems to work fine, and the shell isn't setuid
>either.
>
>-rwxr-xr-x  1 root        16384 Nov 17  1989 /bin/pwd*
>-rwxrwxr-x  2 root       152692 Sep 18 11:51 /usr/local/bin/ksh*

Try saying 'chmod u-rwx .' and then '/bin/pwd'.  You'll probably get
something like "pwd: can't stat .", at least that's what I get.
(This assumes your system doesn't have a built-in get[p]wd() call.
If it does, all bets are off.)

/bin/pwd should be setuid root so that it doesn't get this error.

-- 
cowan at marob.masa.com			(aka ...!hombre!marob!cowan)
			e'osai ko sarji la lojban



More information about the Comp.unix.programmer mailing list