


имеем
-rwxrwx— 1 root root 0 Mar 31 18:19 script.run
хотим запустить его пользователем andrey
добавляем s бит
chmod u+s script.run
-rwsrwx— 1 root root 0 Mar 31 18:19 script.run


меняем бит у группы
chmod g+s script.run

для защиты папок
mkdir papka
chmod 777 papka
touch papka/text.txt
bash-4.2$ ls -l papka/
total 0
-rw-r—r— 1 andrey andrey 0 Mar 31 18:43 text.txt
chmod 666 papka/text.txt
bash-4.2$ ls -l papka/
total 0
-rw-rw-rw- 1 andrey andrey 0 Mar 31 18:43 text.txt
chmod o+t papka/ теперь удалить из папки может только root или владелец
bash-4.2$ ls -l
total 0
drwxrwxrwt 2 andrey andrey 22 Mar 31 18:43 papka