Results 1 to 5 of 5

Thread: Umask understanding

  1. #1
    Join Date
    Apr 2009
    Posts
    61

    Umask understanding

    Hi,

    I am having permission to the folder “Commands” and all the files are 755, but when I have opened a new file in this folder the permissions was set to 644.

    I need to save the time setting these permissions over and over again using “chmod –R 755”, hence I have decided to use Umask
    As I was saying that the Umask is behaving in strange manner.

    Whenever I set a new value for the Umask it is setting the default permission to be the between the current permission and the you have determined.

    Now just take in this way the current default permission are 755 and I am setting the Umask value to 000 so the default permission will remain same as 755, and when I am opening a new file under this folder “Commands” it is having the access permission to its main folder.

    I want to know the reason for this behavior of Umask or the understanding of Umask

    Thanks.

  2. #2
    Dr. V Guest

    Re: Umask understanding

    For the things you want to achieve you have to subtract Umask from 0777 for finding the permissions for directories and then substract from 06666 for finding the permissions for file.

    umask 0022 = 755 for dirs & 644 for files.
    umask 0000 = 777 for dirs & 666 for files.
    umask 0027 = 750 for dirs & 640 for files.
    umask 0077 = 700 for dirs & 600 for files
    umask 0007 = 770 for dirs & 660 for files

    Just make a note of one thing you will not be able to use umask for making new files executable.

  3. #3
    Join Date
    Jun 2009
    Posts
    42

    Re: Umask understanding

    I am a new bee to this topic of umask and I want to know how this umask is determined on the Linux system.
    Here is the some related information which I have read from the book.
    Umask is used for determining the file permission for the files, which are newly created. It can be used for controlling the default permission of the file. But how to implement is practically.

  4. #4
    Join Date
    Jan 2008
    Posts
    3,388

    Re: Umask understanding

    Procedure to setup default umask
    If you want to setup the default umask, you do it by setting up umask in /etc/bashrc or /etc/profile files for all the users. Normally by default it set to 0022 (022) or 0002 (002).
    Open /etc/profile (global) or ~/.bashrc file
    # vi /etc/profile
    or you can do the this.
    $ vi ~/.bashrc

    Then you have to modify the following line for setting up a new umask.
    umask 022
    After that save and close the file. You will be able to see the effect after the next login.

  5. #5
    Join Date
    May 2008
    Posts
    4,085

    Re: Umask understanding

    Here is some more addition to the umask knowledge.

    As it is clear that, the default umask is 0002, which is used for normal users. With the help of this mask default directory permissions are set to 775 and then the default file permissions are 664.

    For calculating the permission for 022 (root user):
    Default Permissions: 777
    Subtract umask value: 022 (-)
    Allowed Permissions: 755

    For calculating the permission for 022 umaks (root user):
    Default Permissions: 666
    Subtract umask value: 022 (-)
    Allowed Permissions: 644

Similar Threads

  1. Need help in understanding my sony ericsson txt pro
    By CheeCha in forum Portable Devices
    Replies: 8
    Last Post: 18-04-2012, 07:05 PM
  2. Help Understanding Linux Programming
    By Jamna in forum Operating Systems
    Replies: 5
    Last Post: 28-05-2011, 10:43 AM
  3. Help Understanding IP
    By guaro in forum Networking & Security
    Replies: 2
    Last Post: 07-07-2010, 11:04 AM
  4. Need help understanding AMD CPU's and compatibility
    By Doshi1 in forum Monitor & Video Cards
    Replies: 3
    Last Post: 04-06-2010, 01:31 PM
  5. What is meant by UMASK
    By Dwarner in forum Operating Systems
    Replies: 3
    Last Post: 18-08-2009, 04:56 PM

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
  •  
Page generated in 1,711,693,184.53679 seconds with 17 queries