- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: umask
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-10-2007 05:34 PM
тАО01-10-2007 05:34 PM
rwx--x-wx
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-10-2007 06:07 PM
тАО01-10-2007 06:07 PM
Re: umask
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-10-2007 06:35 PM
тАО01-10-2007 06:35 PM
Re: umask
Sample use "umask".
$ umask 077
$ umask --> 077
$ umask -S --> u=rwx,g=,o=
$ man umask
rgs,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-11-2007 02:09 PM
тАО01-11-2007 02:09 PM
Re: umask
cd /tmp
mkdir fun_umask
cd fun_umask
umask 022
touch file_with_022
ls -l file_with_022
grep umask /etc/profile
what is your systems default umask ?
now try this one:
umask 0
touch file_with_000
ls -l file_with_000
why did HP-UX provide the default umask settings ? A well known security hole, that's why..
the "touch" command provides a simple method of calling the system call function: creat().. using the umask(1) setting from the parent shell.
let me know if you need more lessons here..
best of luck and of couse we expect points, right :-)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-11-2007 02:42 PM
тАО01-11-2007 02:42 PM
SolutionNow the umask "subtracts" (kinda sorta, but not really, but enough for this explanation) the umask bits from the default permissions.
So:
Example 1:
umask = 022
You create a file:
default perms 666 minus umask 022 = permissions on file of 644 (-rw-r--r--).
You create a directory:
default perms 777 minus umask 022 = permissions of 755 (drwxr-xr-x)
Example 2:
umask = 027
You create a file:
666 - 027 = 640 (-rw-r-----)
Create a dir:
777 - 027 = 750 (drwxr-x---)
If the umask has 4 digits, you can drop the leading 0 (as long as its a 0).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-11-2007 02:42 PM
тАО01-11-2007 02:42 PM
Re: umask
For example you have umask set to 022, so when a file is created by default it gets (666-022) permission i.e 642 .
if you hav umask set to 000 , so the default file permission will be 666-000 = 666
umask on file and directory differs,
for
file = (666-umask value)
dir = (777-umask value)
Now the number convention to rwx
r w x
Owner: 400 200 100
Group: 40 20 10
Other: 4 2 1
-------------------------
So Umask 022 will provide default file creation permission to ( 666-022) = 644
i.e -rw-rw----
Hope this will help,
Cheers,
Raj.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-11-2007 02:57 PM
тАО01-11-2007 02:57 PM
Re: umask
7 7 7
111 111 111
rwx rwx rwx
chmod 777 myfile
: provides mode 777
this assumes your umask is set to ZERO or 000
umask 000
touch myfile
ls -l myfile
mode of file is 777 or rwx-rwx-rwx
x = 1
w = 2
r = 4
=====
7
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-11-2007 02:57 PM
тАО01-11-2007 02:57 PM
Re: umask
Sorry, but NO. 666 - 022 = 644 which = -rw-r--r-- (try it and see!)
The numerical notations are:
(r)ead = 4
(w)rite = 2
e(x)ecute = 1
This is the same for user/owner, group and other/world.
So rwxrwxrwx = 421 421 421 = 777 (if you add each triplet together).
With the chmod command you can use 'chmod 755 file' or 'chmod u=rwx,go=rx file' to grant rwxr-xr-x permissions to a file. u=user (or owner), g=group and o=other (or world). The chmod man page explains this. (I know you didn't ask about chmod, but I'm hoping this will help you understand.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-11-2007 03:08 PM
тАО01-11-2007 03:08 PM
Re: umask
if you have mode:
7 7 7
and umask is set (set to > 000), then you subtract.
example:
$ umask 022
math:
7 7 7
-
0 2 2
=====
well, the first 0 value might be interesting here.. what result do you get ?
try this one:
umask 022
touch file_junk
ls -l file_junk
do you get:
rwx-rx-rx
or
766
given: rwx = 7
rx = 5 (r=4 + x=1) = 5
again: rwx is simply the math of:
r = 4
w = 2
x = 1
=====
total 7
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-11-2007 03:18 PM
тАО01-11-2007 03:18 PM
Re: umask
umask 0
touch file
mode is 7 7 7
or
rwx rwx rwx
umask 022
touch file2
mode is 755 <--- note 755
or
rwx r x r x
not group write, not others write
best of luck and thanks for being a member here !!