LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 07-14-2006, 12:36 PM   #1
anjanesh
Member
 
Registered: Sep 2004
Location: Navi Mumbai
Distribution: Ubuntu 14.04 64-bit
Posts: 230

Rep: Reputation: 30
umask taking the nearest even number


Code:
umask 455
touch s1
ls -l
--w--w--w 1 root root 0 Jul 12 12:51 s1
s1 should've been --wx-w--w (777 - 455 = 322) instead.

So how come its showing --w--w--w ?

RH EL 4.0

Thanks
 
Old 07-14-2006, 02:40 PM   #2
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
With a few quick experiments, my conclusion is that the touch command does not turn on execute privileges--regardless of how umask is set. For example, mkdir behaves as you would expect.
 
Old 07-14-2006, 03:14 PM   #3
haertig
Senior Member
 
Registered: Nov 2004
Distribution: Debian, Ubuntu, LinuxMint, Slackware, SysrescueCD, Raspbian, Arch
Posts: 2,331

Rep: Reputation: 357Reputation: 357Reputation: 357Reputation: 357
umask is not used to SET file permissions, it is used to MASK them. It MASKS against the default permissions, which are 777 for directories and 666 for files. After all, the command is named umask, not uset!

e.g.,
Code:
$ umask 455
$ mkdir ddd
$ >fff
$ ls -l | egrep "(ddd|fff)"
d-wx-w--w-   2 haertig haertig   1024 2006-07-14 14:09 ddd
--w--w--w-   1 haertig haertig      0 2006-07-14 14:09 fff
$
 
Old 07-14-2006, 04:25 PM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
And, on top of all that, why would one want ALL files executable to
begin with? It's just silly.


Cheers,
Tink
 
Old 07-17-2006, 12:12 PM   #5
anjanesh
Member
 
Registered: Sep 2004
Location: Navi Mumbai
Distribution: Ubuntu 14.04 64-bit
Posts: 230

Original Poster
Rep: Reputation: 30
Thanks very much. I was just trying to figure out how the final number is different from the one calculated by us (666 - umask number).
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
which is better- rsyncing number of files OR taking a tar and rsyncing it hk_linux Linux - General 7 02-04-2005 09:17 AM
what is a major number and a minor number ? Menestrel Linux - Newbie 2 10-11-2004 07:53 AM
how do you edit your virtual console number? (or VT number 3) jjorloff1 Linux - General 2 04-03-2004 07:21 PM
why there is a need for minor number and major number for monitor/keyboard in pc? tripathi Solaris / OpenSolaris 1 11-07-2003 09:36 AM
STUPID question on routing and my nearest computer kngharv Linux - Networking 1 07-12-2002 05:26 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 09:20 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration