Əlavəyə görə təşəkkürlər.
Amma orda bir səhvə yol vermisən hesablamada (ümumiyyətlə çox adam səhvə yol verir umask hesablamada)
umask file-lar üçün maximal chmod perm= 666-dır
umask direktoriyalar üçün maximal chmod perm = 777 dir.
Həmin sadə arifmetik qaydada çıxılma etmək düzgün sayılmır.Və ən çox da qarışıqlıq yaradan haldır.
http://teaching.idallen.com/cst8207/13w/notes/510_umask.html
http://www.linuxnix.com/2011/12/umask-define-linuxunix.html
http://www.kutukupret.com/2009/10/08/how-to-calculate-linux-user-umask/
0013 umask verməyimin də səbəbini deyim nəyə görə məhz 0113 yox 0013 verdim.Halbuki hər ikisində sən dediyin müxtəlif umasklarda (umask 0113!=0013) eyni chmod perm ala bilərdim axı:
Ona görə ki, təkcə fayllar deyil direktoriyalar da lazım olur bizə (və 0013-də yaranan direktoriyaya x execute bit vermək ki proses access ala bilsin dirə)
Fragment 1
Kod:
[root@ test]# umask
0113
[root@ test]# mkdir testdir
[root@ test]# ls -tliash
total 12K
664738 4.0K drwxr-xr-x 3 root root 4.0K Feb 20 17:28 .
658511 4.0K drw-rw-r-- 2 root root 4.0K Feb 20 17:28 testdir
664741 0 -rw-rw-r-- 1 root root 0 Feb 20 17:26 test0113de
664740 0 -rw-rw-r-- 1 root root 0 Feb 20 17:25 test13de
664739 0 -rw-rw-r-- 1 root root 0 Feb 20 17:25 test12de
658507 4.0K drwxr-xr-x. 13 root root 4.0K Feb 20 17:23 ..
[root@ test]# umask -S
u=rw,g=rw,o=r
[root@ test]# umask
0113
[root@ test]# umask 0013
[root@ test]# mkdir testdir2
[root@ test]# umask
0013
[root@ test]# umask -S
u=rwx,g=rw,o=r
[root@ test]# ls -tliash
total 16K
664738 4.0K drwxr-xr-x 4 root root 4.0K Feb 20 17:29 .
664682 4.0K drwxrw-r-- 2 root root 4.0K Feb 20 17:29 testdir2
658511 4.0K drw-rw-r-- 2 root root 4.0K Feb 20 17:28 testdir
664741 0 -rw-rw-r-- 1 root root 0 Feb 20 17:26 test0113de
664740 0 -rw-rw-r-- 1 root root 0 Feb 20 17:25 test13de
664739 0 -rw-rw-r-- 1 root root 0 Feb 20 17:25 test12de
658507 4.0K drwxr-xr-x. 13 root root 4.0K Feb 20 17:23 ..
Fragment 2
Kod:
[root@ test]# ls -tliash
total 8.0K
658507 4.0K drwxr-xr-x. 13 root root 4.0K Feb 20 17:23 ..
664738 4.0K drwxr-xr-x 2 root root 4.0K Feb 20 17:23 .
[root@ test]# umask
0022
[root@ test]# umask -S
u=rwx,g=rx,o=rx
[root@ test]# umask 0012
[root@ test]# umask -S
u=rwx,g=rw,o=rx
[root@ test]# umask 0013
[root@ test]# umask -S
u=rwx,g=rw,o=r
[root@ test]# umask 0014
[root@ test]# umask -S
u=rwx,g=rw,o=wx
[root@ test]# umask
0014
[root@ test]# umask 0066
[root@ test]# umask
0066
[root@ test]# umask -S
u=rwx,g=x,o=x
[root@ test]# umask 0077
[root@ test]# umask
0077
[root@ test]# umask -S
u=rwx,g=,o=
[root@ test]# umask 0012
[root@ test]# touch test12de
[root@ test]# ls -aslih test12de
664739 0 -rw-rw-r-- 1 root root 0 Feb 20 17:25 test12de
[root@ test]# umask
0012
[root@ test]# umask 0013
[root@ test]# touch test13de
[root@ test]# ls -aslih *
664739 0 -rw-rw-r-- 1 root root 0 Feb 20 17:25 test12de
664740 0 -rw-rw-r-- 1 root root 0 Feb 20 17:25 test13de
[root@ test]# umask
0013
[root@ test]# umask -S
u=rwx,g=rw,o=r
[root@ test]# umask u=rw,g=rw,o=r
[root@ test]# umask
0113
[root@ test]# umask -S
u=rw,g=rw,o=r
[root@ test]# touch test0113de
[root@ test]# ls -aslih
total 8.0K
664738 4.0K drwxr-xr-x 2 root root 4.0K Feb 20 17:26 .
658507 4.0K drwxr-xr-x. 13 root root 4.0K Feb 20 17:23 ..
664741 0 -rw-rw-r-- 1 root root 0 Feb 20 17:26 test0113de
664739 0 -rw-rw-r-- 1 root root 0 Feb 20 17:25 test12de
664740 0 -rw-rw-r-- 1 root root 0 Feb 20 17:25 test13de