Unix and Linux based sytems define default file permissions with umask.
$ man umask
To see you current permissions just run:
$ umask
>0022
For a more user friendly format:
$ umask -S
>u=rwx,g=rx,o=rx
Person is User, Group and Other.
Properties are Read, Write and eXecute.
umask subtracts from the normal properties set by chmod.
Folder and file are the same, except files will never be set executable by default.
(the -- are just to allign the tables, the numbers are the decimal equivalent for a 1 set in that position)
--421,--421,--421
u=rwx,g=rwx,o=rwx
Say you (User) want full access to a file but not allow Group or Other access.
you want:
--421,--000,-000 ie 700
The mask would be
--000,--421,--421 => 077
to set this just run (and may be add to your ~/.bashrc file) :
$ umask 077
You (User) want full access, Group has read and execute and Other none
--421,--401,--000 ie 750
the mask would be:
--000,--020,--421 => $ umask 027
You (User) have full access and Group and other have read and execute.
--421,--401,--401 ie 755
mask would be:
--000,--020,--020 => $ umask 022
NB:
Q) How do i set umask to make files executable by default?
A) You can not create exectuable file by default using umask, it is thought to be a security issue.
Twitter Updates
Thursday, 23 April 2009
New file and directory permissions on unix
Labels:
Bash,
Debian,
Filesystem,
Leopard,
Linux,
Mac,
OS X,
Programming
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment