Find the answer to your Linux question:
Results 1 to 5 of 5
how do i get a umask to give 775 permission by default, setting umask 002 will set 775 permissions for folders, but 664 for files. Is there a way to ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jun 2006
    Posts
    4

    umask on files


    how do i get a umask to give 775 permission by default, setting umask 002 will set 775 permissions for folders, but 664 for files. Is there a way to have 775 set by default for both files and folders?

  2. #2
    Linux User DThor's Avatar
    Join Date
    Jan 2006
    Location
    Ca..na...daaa....
    Posts
    319
    It does this because it assumes the end result permission is what you want, not the number. The directories are different because they must be executable in order for their contents to be read. Am I correct in understanding that you want directories to be unreadable by absolutely everyone(which is what you're asking for)? I would think you want:

    -rw-rw-r--

    for files and

    drwxrwxr-x

    for directories, which is what umask 002 gives you.

    Anyway, perhaps you can explain further.

    DT

  3. #3
    Just Joined!
    Join Date
    Jun 2006
    Posts
    4
    directory permissions : 775
    file permissions: 775

    umask currently set : 002

    For both directories and individual files, I basically want the group and owner to have full access (7) while others only to have read and execute (5).

  4. $spacer_open
    $spacer_close
  5. #4
    Linux User DThor's Avatar
    Join Date
    Jan 2006
    Location
    Ca..na...daaa....
    Posts
    319
    You can't. First off, as already explained, you can't set one umask value and get the same *octal notation* for files and directories, because the whole idea behind umask is that it *masks*, or *removes* values from the system defaults, which differs for files and directories, as I mentioned above.

    Secondly, umask can't let you create executable files by default, for security reasons(this would be a huge back door for hacking). Applications such as the C compiler can create files with executable bits, but it's the app that does it, not the shell.

    DT

  6. #5
    Just Joined!
    Join Date
    Jun 2006
    Posts
    4
    gotcha, thanks

Posting Permissions

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