Sunteți pe pagina 1din 8

Best practices for umask in Red Hat Enterprise Linux - Red Hat Custome... https://access.redhat.

com/solutions/107683

umask

022

-rwxr-xr-x

1 of 8 7/12/2019, 5:53 PM
Best practices for umask in Red Hat Enterprise Linux - Red Hat Custome... https://access.redhat.com/solutions/107683

mode open(2) 002


-rwxrwxr-x
mode open(2)
umask

$ info coreutils 'chmod invocation'

if [ "`id -gn`" = "`id -un`" -a `id -u` -gt 99 ]; then


umask 002
else
umask 022
fi

2 of 8 7/12/2019, 5:53 PM
Best practices for umask in Red Hat Enterprise Linux - Red Hat Custome... https://access.redhat.com/solutions/107683

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


umask 002
else
umask 022
fi

$ source /etc/profile
$ source /etc/bashrc

$ umask
0002

3 of 8 7/12/2019, 5:53 PM
Best practices for umask in Red Hat Enterprise Linux - Red Hat Custome... https://access.redhat.com/solutions/107683

0 Hungry(tmg)/home/tmg Yo> umask


0002
0 Hungry(tmg)/home/tmg Yo> id
uid=15049(tmg) gid=15049(tmg) groups=15049(tmg),493(phnx)
context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
0 Hungry(tmg)/home/tmg Yo> mkdir /tmp/phnx
0 Hungry(tmg)/home/tmg Yo>

0 Hungry(tmg)/home/tmg Yo> chgrp phnx /tmp/phnx


0 Hungry(tmg)/home/tmg Yo> chmod g+s /tmp/phnx
0 Hungry(tmg)/home/tmg Yo> ls -la /tmp/phnx
total 44
drwxrwsr-x. 2 tmg phnx 4096 May 7 14:18 ./
drwxrwxrwt. 32 root root 36864 May 7 14:18 ../
0 Hungry(tmg)/home/tmg Yo> cd /tmp/phnx
0 Hungry(tmg)/tmp/phnx Yo> echo Hello > some.file
0 Hungry(tmg)/tmp/phnx Yo> echo Good bye. > some.other.file
0 Hungry(tmg)/tmp/phnx Yo> ls -la
total 52
drwxrwsr-x. 2 tmg phnx 4096 May 7 14:24 ./
drwxrwxrwt. 32 root root 36864 May 7 14:23 ../
-rw-rw-r--. 1 tmg phnx 6 May 7 14:24 some.file
-rw-rw-r--. 1 tmg phnx 10 May 7 14:24 some.other.file
0 Hungry(tmg)/tmp/phnx Yo>

4 of 8 7/12/2019, 5:53 PM
Best practices for umask in Red Hat Enterprise Linux - Red Hat Custome... https://access.redhat.com/solutions/107683

0 Hungry(tmg)/tmp/phnx Yo> chmod g-s .


0 Hungry(tmg)/tmp/phnx Yo> echo Uh oh. > yet.another.file
0 Hungry(tmg)/tmp/phnx Yo> ls -la
total 56
drwxrwxr-x. 2 tmg phnx 4096 May 7 14:26 ./
drwxrwxrwt. 32 root root 36864 May 7 14:23 ../
-rw-rw-r--. 1 tmg phnx 6 May 7 14:24 some.file
-rw-rw-r--. 1 tmg phnx 10 May 7 14:24 some.other.file
-rw-rw-r--. 1 tmg tmg 7 May 7 14:26 yet.another.file
0 Hungry(tmg)/tmp/phnx Yo>

0 Hungry(tmg)/home/tmg Yo> echo Make me a file. > /tmp/one.more.file


0 Hungry(tmg)/home/tmg Yo> ls -la /tmp/one.more.file
-rw-rw-r--. 1 tmg tmg 16 May 7 14:45 /tmp/one.more.file
0 Hungry(tmg)/home/tmg Yo>

5 of 8 7/12/2019, 5:53 PM
Best practices for umask in Red Hat Enterprise Linux - Red Hat Custome... https://access.redhat.com/solutions/107683

6 of 8 7/12/2019, 5:53 PM
Best practices for umask in Red Hat Enterprise Linux - Red Hat Custome... https://access.redhat.com/solutions/107683

[ "`/usr/bin/id -gn`" = "`/usr/bin/id -un`" ]

7 of 8 7/12/2019, 5:53 PM
Best practices for umask in Red Hat Enterprise Linux - Red Hat Custome... https://access.redhat.com/solutions/107683

/etc/bashrc
/etc/profile

8 of 8 7/12/2019, 5:53 PM

S-ar putea să vă placă și