Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!cwjcc!hal!nic.MR.NET!thor.acc.stolaf.edu!mackenzi From: mackenzi@thor.acc.stolaf.edu (David MacKenzie) Newsgroups: alt.sources Subject: Re: chmod args (was Re: Need a "watching" program) Message-ID: <2336@thor.acc.stolaf.edu> Date: 5 Jun 89 06:22:31 GMT References: <8923@csli.Stanford.EDU> <11680@s.ms.uky.edu> <8928@csli.Stanford.EDU> <12743@ihlpy.ATT.COM> <1953@ur-cc.UUCP> <2126@amelia.nas.nasa.gov> <8605@chinet.chi.il.us> <1738@auspex.auspex.com> <32248@bu-cs.BU.EDU> Reply-To: mackenzi@thor.stolaf.edu (David MacKenzie) Distribution: usa Organization: Environmental Defense Fund Lines: 31 In article <32248@bu-cs.BU.EDU> bzs@bu-cs.BU.EDU (Barry Shein) writes: > >Many years ago I wrote a simple shell script for new users "setfile" >which took either "private" or "public" and a list of one or more file >or dir names. It then set the files to reasonable values (private=user >only, public=everyone could read and/or execute, only user write in >all cases.) So: > > setpriv public a b c > setpriv private x y z > >Seemed to eliminate a lot of errors. The only tricky part of the >script is propagating the execute bit rationally. Also that some shell >tests do "the wrong thing" for root, but root shouldn't use the script >(but of course it happened, yielding odd results.) Here's another approach that I use: two scripts, 'private' and 'public': #!/bin/sh # private - remove group and other permissions # Usage: private file . . . exec chmod go-rwx $* #!/bin/sh # public - copy user permissions into group and other (umask considered) # Usage: public file . . . exec chmod =u $* -- David MacKenzie mackenzi@thor.stolaf.edu or edf@rocky2.rockefeller.edu