Find the answer to your Linux question:
Results 1 to 6 of 6
I get different value of umask for root and a normal user??? For root: Code: umask 0022 for normal user Code: umask 0002...
  1. #1
    Linux User vickey_20's Avatar
    Join Date
    Mar 2009
    Location
    Mumbai, India
    Posts
    493

    umask haivng different value

    I get different value of umask for root and a normal user???
    For root:
    Code:
    umask 
    0022
    for normal user
    Code:
    umask
    0002
    Only if I could understand the man pages
    Registered Linux user #492640
    OS: RHEL4,5 ,RH 9,Ubuntu

  2. #2
    Linux Guru
    Join Date
    Nov 2007
    Location
    Córdoba (Spain)
    Posts
    1,513
    If you use bash, you can look into the ~/.bashrc and ~/.bash_profile files for each user, or into /etc/profile. Maybe there's a umask there.

    If you use other shell check the man page for your shell of choice to know what the initialization files for this shell are.

  3. #3
    Linux User vickey_20's Avatar
    Join Date
    Mar 2009
    Location
    Mumbai, India
    Posts
    493
    is there a way to search the contents of the above file without looking into each one of them as I am not sure it may b in which file.
    Only if I could understand the man pages
    Registered Linux user #492640
    OS: RHEL4,5 ,RH 9,Ubuntu

  4. #4
    Linux Guru
    Join Date
    Nov 2007
    Location
    Córdoba (Spain)
    Posts
    1,513
    You can always use grep.

    Code:
    grep umask /etc/*
    #or
    grep umask ~/.*

  5. #5
    Linux User vickey_20's Avatar
    Join Date
    Mar 2009
    Location
    Mumbai, India
    Posts
    493

    I think it's the default value of umask for user

    I created a new user just to check out the umask value for the same . The o/p obtained is
    Code:
    umask 0002
    so I suppose that the umask for normal user is 0002 and for root is 0022
    Only if I could understand the man pages
    Registered Linux user #492640
    OS: RHEL4,5 ,RH 9,Ubuntu

  6. #6
    Linux User vickey_20's Avatar
    Join Date
    Mar 2009
    Location
    Mumbai, India
    Posts
    493

    It makes perfect sense

    Yes it makes perfect sense .
    Code:
    root
    umask 0022
    File  666-0022= 644= -rw- r-- r--
    Dir   777-0022=755= -rwx -r-x r-x
    Code:
    Normal User
    File 666-0002=664= -rw -rw -r--
    Dir   777-0002=775= -rwx -rwx r-x
    The only difference the umask for normal user make is in the 2nd column and it makes perfect sense( again) coz root doesn't have any group where as a normal user can have a group which may need to access and modify the same resource( ie. w)
    Only if I could understand the man pages
    Registered Linux user #492640
    OS: RHEL4,5 ,RH 9,Ubuntu

Posting Permissions

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