Find the answer to your Linux question:
Results 1 to 3 of 3
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #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,842
    Should that be 777 rather than 666?
    Should you be sitting wondering,
    Which Batman is the best,
    There's only one true answer my friend,
    It's Adam Bloody West!


    The Fifth Continent

  3. #3
    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
  •