Monday, 28 August 2017

How to set umask for a System User in RHEL/Centos



When user created a file or directory under in Centos/RHEL, the file or directory created with a default set of permissions. By default the file permission has 644 a directory created with 755 permissions, grants read, write, and execute permission to the owner and read and execute permission to groups and others.


By default you will get the umask 077 as below:

[root@linuxcnf ~]# grep -i umask /etc/login.defs
UMASK           077
[root@linuxcnf ~]#

We can change the user default umask by editing /etc/login.defs file as below:
Set UMASK in /etc/login.defs:

[root@linuxcnf ~]# vi /etc/login.defs
#Change the umask value 027 from 077
UMASK         027

That’s it you have done. Check the same using grep command:

[root@linuxcnf ~]# grep -i umask /etc/login.defs
UMASK           027
[root@linuxcnf ~]#


No comments:

Post a comment