su/umask RHEL 6 vs RHEL 9
Hello,
I am trying to understand a difference in behavior observed between RHEL 6 and RHEL 9.
We have set a umask of 077 in all our environments (both RHEL 6 and RHEL 9) for security reasons, but we override it for certain users by updating their .bashrc file.
On RHEL 6
Become root and and "umask 022" to root's .bashrc file
Run the following command to create a file as a different user:
su [another_user] -c "touch /tmp/testfile.txt"
*the /tmp/testfile.txt is created with a permission of 644, which is expected with a umask of 022
On RHEL 9
Follow all of the above steps exactly as described; however, the /tmp/testfile.txt is created with a permission of 600 instead of 644 - it seems the umask in .bashrc is not being read and the system wide umask is applying
I'm trying to understand what could cause this difference.