Path: utzoo!attcan!uunet!aplcen!uakari.primate.wisc.edu!uflorida!mlb.semi.harris.com!thrush.mlb.semi.harris.com!del From: del@thrush.mlb.semi.harris.com (Don Lewis) Newsgroups: comp.unix.programmer Subject: Re: Why use pwd(1) for getpwd(3C)? (Re: Why use find?) Message-ID: <1990Oct11.221853.26261@mlb.semi.harris.com> Date: 11 Oct 90 22:18:53 GMT References: <1990Oct10.231857.11668@virtech.uucp> <14976@hydra.gatech.EDU> <2714A558.14A8@marob.masa.com> Sender: news@mlb.semi.harris.com Organization: Harris Semiconductor, Melbourne FL Lines: 21 Nntp-Posting-Host: thrush.mlb.semi.harris.com In article <2714A558.14A8@marob.masa.com> cowan@marob.masa.com (John Cowan) writes: >>in article <1990Oct10.231857.11668@virtech.uucp>, cpcahil@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). >> >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. If the current directory (or another directory higher in the tree) is not publicly readable and lives on an NFS mounted filesystem which maps root to nobody, then making /bin/pwd setuid root will break it. In this case running /bin/pwd as the real user will work. -- Don "Truck" Lewis Harris Semiconductor Internet: del@mlb.semi.harris.com PO Box 883 MS 62A-028 Phone: (407) 729-5205 Melbourne, FL 32901