1 00:00:06,780 --> 00:00:07,613 - All right. 2 00:00:07,613 --> 00:00:10,893 Next task is to create the file /tmp/protectedfile, 3 00:00:11,859 --> 00:00:14,130 containing the text, I am protected. 4 00:00:14,130 --> 00:00:17,070 And ensure that this file can be added to, but not removed, 5 00:00:17,070 --> 00:00:19,833 and current contents cannot be changed. 6 00:00:22,200 --> 00:00:26,807 So the solution is obviously in attributes, man chattr. 7 00:00:28,890 --> 00:00:32,910 And what we need is the attribute a for append only. 8 00:00:32,910 --> 00:00:36,183 So let me create /tmp/protectedfile. 9 00:00:41,400 --> 00:00:45,093 And in there, the text, I am protected. 10 00:00:45,990 --> 00:00:47,970 If you see questions like this on the exam, 11 00:00:47,970 --> 00:00:49,650 make sure you don't make any typos 12 00:00:49,650 --> 00:00:51,960 because if they want you to have a text in there, 13 00:00:51,960 --> 00:00:54,840 then really they are going to check for it 14 00:00:54,840 --> 00:00:56,943 and you'll lose points if you have a typo. 15 00:00:57,900 --> 00:00:59,310 So that was easy. 16 00:00:59,310 --> 00:01:01,680 And the other part also is not very complicated. 17 00:01:01,680 --> 00:01:05,883 Chattr +a on /tmp/protectedfile. 18 00:01:08,274 --> 00:01:13,274 Lsattr on /tmp/protectedfile is showing you that this works. 19 00:01:15,570 --> 00:01:20,570 Let's do echo hello >> /tmp/protectedfile, which is working. 20 00:01:22,470 --> 00:01:27,470 Let's use rm -f on /tmp/protectedfile, which is not allowed. 21 00:01:29,220 --> 00:01:32,160 So protectedfiles, append only. 22 00:01:32,160 --> 00:01:33,630 It's a useful attribute. 23 00:01:33,630 --> 00:01:36,240 Not as commonly known as immutable, 24 00:01:36,240 --> 00:01:38,103 but definitely very useful as well.