chmod args (was Re: Need a "watching" program)

David MacKenzie mackenzi at thor.acc.stolaf.edu
Mon Jun 5 16:22:31 AEST 1989


In article <32248 at bu-cs.BU.EDU> bzs at 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 at thor.stolaf.edu or edf at rocky2.rockefeller.edu



More information about the Alt.sources mailing list