Cannot get umask setting to stick


Results 1 to 4 of 4

Thread: Cannot get umask setting to stick

  1. #1
    Join Date
    Mar 2005
    Location
    US
    Posts
    300

    Cannot get umask setting to stick

    CentOS6.2 64-bit

    I've changed the umask setting in in /etc/bashrc from the default to 027 for security reasons, it now looks like this:

    if [ $UID -gt 99 ] && [ "`id -gn`" = "`id -un`" ]; then
    umask 027
    else
    umask 027
    fi

    Tried disabling selinux and rebooted, all to no avail.

    Now, on 2 other systems, not running not running same version levels though, this change has worked fine, but on CentOS6.2 64-bit it appears to do nothing, and yes, I have logged off/on - any ideas?
    Last edited by fishface; 05-07-2012 at 11:11 AM.

  2. #2
    Join Date
    Sep 1999
    Posts
    3,202
    umm... why bother with the if-then statement if your else condition is to set the same umask?

    I'd remove the logic and then just set it.

    Also while checking on my debian wheezy set up (don't have centos anywhere handy) I see a note in /etc/profile that the umask settings are now handled by pam_umask and /etc/login.defs - could something similar be going on with your centos system?

  3. #3
    Join Date
    Mar 2005
    Location
    US
    Posts
    300
    The bashrc is the installed default, all I changed was umask number, but your're right...wonder why CentOS did it that way.

    The same setting works fine on CentOS5.4 32-bit, and the bashrc appear to be identical.

    I know Debian/Ubuntu do system wide umask in a different way.

    There might be something in the pam_umask...I'll check into that and report back...thanks for the tip!

    I'll try setting the umask in bashrc with the logic removed and see how that works out.

  4. #4
    Join Date
    Mar 2005
    Location
    US
    Posts
    300
    Okay, I changed the second umask value (else) back to the default value of 022, left the if value at 027 and it now works fine.

    Before:
    if [ $UID -gt 99 ] && [ "`id -gn`" = "`id -un`" ]; then
    umask 027 <==== default was 022
    else
    umask 027 <==== default was 022
    fi

    To:

    if [ $UID -gt 99 ] && [ "`id -gn`" = "`id -un`" ]; then
    umask 027
    else
    umask 022 <==== default value
    fi

Posting Permissions

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