making umask persistent? /etc/bashrc? etc/profile

[root@localhost ]#vim /etc/bashrc

if [ $UID -gt 199 ] && [ "`id -gn`" = "`id -un`" ]; then

umask 066

else

umask 022

fi

[root@localhost ]#vim /etc/profile

if [ $UID -gt 199 ] && [ "`id -gn`" = "`id -un`" ]; then

umask 066

else

umask 022

fi

  • post-author-pic
    Abdoulmalik S
    10-24-2018

  • post-author-pic
    Abdoulmalik S
    10-24-2018

  • post-author-pic
    Abdoulmalik S
    10-24-2018

  • post-author-pic
    Abdoulmalik S
    10-24-2018

  • post-author-pic
    Abdoulmalik S
    10-24-2018

  • post-author-pic
    Abdoulmalik S
    10-24-2018

  • post-author-pic
    Abdoulmalik S
    10-24-2018

  • post-author-pic
    Abdoulmalik S
    10-24-2018

  • post-author-pic
    Abdoulmalik S
    10-24-2018

  • post-author-pic
    Abdoulmalik S
    10-24-2018

  • post-author-pic
    Abdoulmalik S
    10-24-2018

  • post-author-pic
    Abdoulmalik S
    10-24-2018

  • post-author-pic
    Abdoulmalik S
    10-24-2018

  • post-author-pic
    Brandon B
    10-24-2018

    Hello,


    So the short answer is use /etc/profile when you want it to only affect interactive, or login, shells and use /etc/bashrc when you want it to affect interactive and non-interactive shells, like BASH scripts that are run.

    It really depends on what you are trying to accomplish and if you have scripts that are run by the system that do not require a user login, but do create files.

Looking For Team Training?

Learn More