Возможно ли разрешить в Linux только создание файла, но не его изменение или удаление? Бэкап, куда можно лишь сбрасывать данные, а читать лишь администратору.
1 ответ
Думаю вам нужен acl
~# apropos setfacl
setfacl (1) - set file access control lists
~# touch test_file && chmod 700 test_file
~# stat test_file
File: test_file
Size: 0 Blocks: 0 IO Block: 4096 regular empty file
Device: fd02h/64770d Inode: 266127 Links: 1
Access: (0700/-rwx------) Uid: ( 0/ root) Gid: ( 0/ root)
Context: unconfined_u:object_r:user_tmp_t:s0
Access: 2018-08-29 00:52:52.283387184 +0100
Modify: 2018-08-29 00:52:52.283387184 +0100
Change: 2018-08-29 00:53:26.822119567 +0100
Birth: -
~# setfacl -m u:lfs:w test_file
~# su lfs
~$ cat test_file
cat: test_file: Permission denied
~$ echo "test line" >> test_file
~$ exit
~# cat test_file
hello world
test line