Page 1 of 2 12 LastLast
Results 1 to 10 of 19

Thread: What is fmask umask and dmask?

  1. #1
    Join Date
    Mar 2009
    Location
    Cambridge
    Beans
    56
    Distro
    Ubuntu

    What is fmask umask and dmask?

    Hi Guys,
    I googled for it. But couldnt find anything proper. There were explanations saying fmask is related to umask. But what is umask?! I even found a thread in our forum. http://ubuntuforums.org/showthread.php?t=7702 . Am I right in saying umask is the permission of the file?
    say 7 read, write and execute
    6 read and write

    Am I right? Forgive my ignorance.

    Cheers,
    Tony

  2. #2
    Join Date
    Apr 2005
    Location
    Finland/UK
    Beans
    Hidden!
    Distro
    Ubuntu 16.04 Xenial Xerus

    Re: What is fmask umask and dmask?

    fmask = file mask, umask = user mask and dmask = directory mask. And they all are used to define permissions (umask sets them to both files and directories, while fmask only applies to files and dmask to directories).

    The masks are no the permissions of the file, they are used to get the permissions you want. In addition masks can't add any permissions, they only limit what permissions a file or a directory can have.
    Last edited by mcduck; April 13th, 2010 at 12:01 PM.

  3. #3
    Join Date
    Dec 2008
    Location
    UK
    Beans
    173
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: What is fmask umask and dmask?

    uhm, i always get confused too, but i think masks are the opposite from straight forward permissions,

    ie 777 permissions would be 000 in a mask.
    755 would be 022 in a mask.
    750 would be 027 in a mask.

    i could be wrong, in fact, i probably am. if someone could clarify this for me?

  4. #4
    Join Date
    Jan 2009
    Location
    Denmark
    Beans
    Hidden!
    Distro
    Ubuntu 12.04 Precise Pangolin

    Thumbs up Re: What is fmask umask and dmask?

    umask is set to controld permissions (set by the server administrator) for newly created files & directories. That is created by other users on the system.

    When you set a umask for example 0666 then you need to minus this 0666 with 0777 for a directory and 0666 for files.
    And then you get a system umask of 0111. 0666 - 0777 = 0111 for your directoryes, and 0555 for your files.

    The directory number to minus your umask with is 0777 and
    the files number to minus your umask with is 0666

    Another example. Directory.
    0222 - 0777 = 0555
    0274 - 0777 = 0503

    and Files.
    0222 - 0666 = 0444
    0264 - 0666 = 0402

    a umask 0000 is = 0777 = all permissions
    Read
    Write
    Execute

    a umask 0111 is = 0666 = Read + Write

    When looking at permissions you see

    x xxx xxx xxx
    x = Type (directory, file, special files e.c.t)
    #1 xxx = users
    #2 xxx = groups
    #3 xxx = others

    These 3 x then has a value.
    4 2 1 4 2 1 4 2 1
    X X X X X X X X X
    R W X R W X R W X

    R = Read
    W = Write
    X = Execute

    the value 7 is all the numbers in a XXX group put together 4+2+1 = 7 = all permissions.

    If it was 0752 then it would be
    #1 Users = all permissions 4+2+1 = 7
    #2 Groups = Write + Execute 4+1 = 5
    #3 Others = Write 2 = 2

    Hope this helps

    ADDED:
    For the first digit in a umask. Its a sticky bit.

    (4)xxx sets the SUID
    (2)xxx sets the SGID
    (1)xxx sets the sticky bit
    (6)xxx sets both the SUID and SGID
    (7)xxx sets all three

    The sticky bit does if more people (a group) has 0777 permissions to a file, then they can delete the file also. If i want
    them to have all permissions but not able to delete the file i can set a sticky bit 1777 and then its only the owner of the file who can delete it. The group can still see the file, open it, change its contents. They can do all that the permissions alow them to EXECT deleting the file.

    And then the permissions would look like this rwx-rwx-rwt the t reporsents the sticky bit. A umask of 1777


    Its about remembering
    Last edited by Drenriza; April 13th, 2010 at 01:37 PM. Reason: Corrected some mistakes :( sry

  5. #5
    Join Date
    Dec 2008
    Location
    UK
    Beans
    173
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: What is fmask umask and dmask?

    what's the point in the first 0?

  6. #6
    Join Date
    Jan 2009
    Location
    Denmark
    Beans
    Hidden!
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: What is fmask umask and dmask?

    Edited #4
    Last edited by Drenriza; April 13th, 2010 at 01:36 PM.

  7. #7
    Join Date
    Jan 2010
    Location
    TN USA
    Beans
    398
    Distro
    Xubuntu

    Re: What is fmask umask and dmask?

    Quote Originally Posted by NiGhtMarEs0nWax View Post
    what's the point in the first 0?
    It controls special permissions such as set uid (run as another user) and the sticky bit (keep a file in memory after executing)..

  8. #8
    Join Date
    Apr 2007
    Location
    Eastern USA
    Beans
    416
    Distro
    Ubuntu

    Re: What is fmask umask and dmask?

    Drenriza your post has been bookmarked in my firefox profile.

    Sometimes Manpages just don't explain enough. And the general idea is good, but I'm also glad to know how the math is actually done.

  9. #9
    Join Date
    Dec 2008
    Location
    UK
    Beans
    173
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: What is fmask umask and dmask?

    Quote Originally Posted by cjhabs View Post
    It controls special permissions such as set uid (run as another user) and the sticky bit (keep a file in memory after executing)..

    nice, thank you.

  10. #10
    Join Date
    Mar 2009
    Location
    Cambridge
    Beans
    56
    Distro
    Ubuntu

    Re: What is fmask umask and dmask?

    Thank you very much Drenriza. Does the same rule apply for dmask and fmask (I assume they are same)?
    I know the permission can be changed using chmode. I recently came to know chown also does the same. Is there any difference between them?

Page 1 of 2 12 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

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