Find the answer to your Linux question:
Results 1 to 3 of 3
I want to create a file with permission bits : 125 => --x-w-r-x . So the umask value should be => oct(666 & ~125) = 0642 so when I write ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Dec 2013
    Posts
    1

    Angry why umask result differs from the permission bits


    I want to create a file with permission bits : 125 => --x-w-r-x .

    So the umask value should be => oct(666 & ~125) = 0642

    so when I write commands below ;

    Code:
    umask 0642
    touch /tmp/newfile
    ls -l /tmp/newfile
    
    the result is not 125 .
    why the result of umask is not 125 ?
    thanks in advance.

  2. #2
    Penguin of trust elija's Avatar
    Join Date
    Jul 2004
    Location
    Either at home or at work or down the pub
    Posts
    3,622
    Should that be 777 rather than 666?
    "I used to be with it, then they changed what it was.
    Now what was it isn't it, and what is it is weird and scary to me.
    It'll happen to you too."

    Grandpa Simpson



    The Fifth Continent

  3. #3
    Just Joined!
    Join Date
    Jan 2014
    Posts
    5
    Because the execute bit is not set automatically when you create a file, only when you create a directory.

    Set the umask to 0652, and create a directory and you'll get what you're looking for.

  4. $spacer_open
    $spacer_close

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •