Date: Tue, 23 Apr 1996 17:25:59 -0700 (PDT) From: Jim Dennis <jimd@mistery.mcafee.com> To: cyborg1@mail.pernet.net (Nitemaster) Cc: questions@freebsd.org Subject: Re: chmod Message-ID: <199604240025.RAA00909@mistery.mcafee.com> In-Reply-To: <317D26B8.1B8E@mail.pernet.net> from "Nitemaster" at Apr 23, 96 01:51:36 pm
next in thread | previous in thread | raw e-mail | index | archive | help
> > What numbers should I use for this - chmod o+w filename? o+w *adds* the write permission -- chmod with a numeric *sets* the permission. Thus (given): -r--r--r-- 1 jimd users 1024 Apr 9 14:29 foo The command 'chmod o+x foo' would result in: -rw-r--r-- 1 jimd users 1024 Apr 9 14:29 foo While the command 'chmod 200' would result in: --w------- 1 jimd users 1024 Apr 9 14:29 foo (basically an absurd set of permissions). Basically you can think of the "symbolic" switches for 'chmod' as "relative" and the "numeric" form as "absolute." To remember which numerics are which, keep in mind that only a subset of the eight permutations are sensible for way over 90% of all cases: Most common: 7 (all -- common for directories, files would be *executable*) 6 (read and write to normal files) 5 (read and execute) 4 (read only) 0 (non privileges) Less common: 1 (execute only -- often doesn't work on scripts or binaries usually you have to read something in order to execute it might be used for "dark" directories -- pass through but no ls other permissions) 2 (write only -- I can see arguments for this if it is backed up by a chattr/chflags to "append only" properties -- otherwise it's useless) Useless (???): 3 (execute and write: might be some directories like ftp incoming -- should be a "sticky" directory if the OS supports it can't imagine any use for files)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199604240025.RAA00909>