1 00:00:06,540 --> 00:00:11,169 In this video you'll learn about umask and how it is used to set default permissions. 2 00:00:12,810 --> 00:00:19,789 So the umask is a shell setting that defines a mask that will be subtracted from the default permissions. 3 00:00:21,070 --> 00:00:25,730 It's normally set from the shell startup files, etc profile and etc bashrc. 4 00:00:26,829 --> 00:00:33,329 And to understand it, default permissions on directories are 777 and default permissions on false are 666. 5 00:00:35,030 --> 00:00:39,695 Now if you use the umask of 022, which is pretty common, it 6 00:00:39,695 --> 00:00:44,359 will set default permissions on false to 644 and on directories to 755. 7 00:00:45,439 --> 00:00:51,810 And if you have the umask of 027, it will set default permissions on directories to 750 and on valves to 6, 4, 0. 8 00:00:54,689 --> 00:00:55,560 Let me demonstrate. 9 00:00:57,729 --> 00:01:01,909 I'm typing umask and now we can see that umask in fact it's four digits. 10 00:01:02,530 --> 00:01:06,965 The first digit is for the special permissions. You do not ever want 11 00:01:06,965 --> 00:01:11,400 to modify your special permissions through a umask. It really doesn't make sense. 12 00:01:12,000 --> 00:01:14,299 So ignore it. Pretend as if it's not here. 13 00:01:14,920 --> 00:01:18,634 Now the result is that when I use touch file 1 LS 14 00:01:18,634 --> 00:01:22,349 L on file 1 has a permission mode set to 644. 15 00:01:23,790 --> 00:01:27,495 Now when I change my umask to 0 to 7, I 16 00:01:27,495 --> 00:01:31,200 verify using the umask, it's set to 0 to 7. 17 00:01:32,159 --> 00:01:39,055 And I use touch file 2 and LS L on file 2 is showing that others has no permissions anymore. 18 00:01:39,055 --> 00:01:45,950 If you want your umask to be effective, you need to set it through one of these shell startup files. 19 00:01:47,170 --> 00:01:51,983 But be careful, because if you set 0 to 7, for 20 00:01:51,983 --> 00:01:56,796 instance, that means that others in no case will have read 21 00:01:56,796 --> 00:02:01,609 permissions to files anymore. And that might seriously mess up stuff. 22 00:02:02,359 --> 00:02:09,099 If I may give you an advice, leave your umask alone. Your distribution is setting the umask the right way in most 23 00:02:09,099 --> 00:02:15,840 cases. So leave it alone. Don't mess with it, because you might be in for some nice troubleshooting if you do.