LinuxSA Mailing list archives
Index:
[thread]
[date]
[subject]
[author]
[stats]
From: Richard Russell <richard@yellowgoanna.com>
To : Anthony Symons <ant@sa.pracom.com.au>
Date: Fri, 9 Nov 2001 16:50:17 +1030
Re: Article on Linux+
Ah, I just saw your second mail, but dammit, I took time writing this,
so I'm sending it anyway :)
On Fri, Nov 09, 2001 at 04:25:01PM +1030, Anthony Symons wrote:
> Yes, it all sounds dodgy to me. What about this?
man umask may help here... ;)
> Question 4
> With a umask value of 12, what are the default permissions
> assigned to newly created files?
>
> a. ---x--x-wx
> b. -rw-rw-r--
> c. -r-xr-xr--
> d. -rw-rw----
>
> I make it ----(--x)(-w-), and so does my linux system:
> 1 2 = 12
actually, umask = 012 means newly created executable files are 777
(bitwise) minus 012 and newly created non-executables are 666
(bitwise) minus 012
111 111 111
- 000 001 010
= 111 110 101
rwx rw- r-x
and non-executables:
110 110 110
- 000 001 010
= 110 110 100
rw- rw- r--
hence, b is correct, for non-executable files...
>
> [ant@ant ant]$ touch test
> [ant@ant ant]$ ls -al test
> -rw-rw-r-- 1 ant ant 0 Nov 9 16:22 test
> [ant@ant ant]$ chmod 12 test
> [ant@ant ant]$ ls -al test
> ------x-w- 1 ant ant 0 Nov 9 16:22 test*
try running:
# see your current umask
umask
touch test
ls -al test
chmod 777 test
cp test test2
ls -al test2
# and now set to 012
umask 012
touch newtest
ls -al newtest
chmod 777 newtest
cp newtest newtest2
ls -al newtest2
rm test test2 newtest newtest2
and see what you see... :)
rr
--
Richard Russell
Yellow Goanna Pty Ltd
e: richard@yellowgoanna.com
m: +61 412 827 805
f: +61 8 8462 2362
--
LinuxSA WWW: http://www.linuxsa.org.au/ IRC: #linuxsa on irc.linux.org.au
To unsubscribe from the LinuxSA list:
mail linuxsa-request@linuxsa.org.au with "unsubscribe" as the subject
Index:
[thread]
[date]
[subject]
[author]
[stats]
Return to the LinuxSA Mailing List Information Page