Portál AbcLinuxu, 13. května 2025 03:55
$ pwd /home/user $ ls -l /home/ total 20 drwx-----T 2 userusers 4096 Sep 30 16:58 user drwx------ 2 root root 16384 Oct 25 2012 lost+found $ ls test.txt $ id uid=1001(user) gid=100(users) groups=100(users) $ rm test.txt rm: remove write-protected regular file ‘test.txt’? y $ ls $1) Myslel jsem ze kdyz na adresar nastavim sticky bit, tak soubory muze mazat pouze jejich vlastnik - v tomto pripade root. Jak je tedy mozne, ze soubor test.txt muze smazat i neprivilegovany uzivate user? 2) Jak uzivatelovi user zabranit, aby mohl soubor test.txt smazat a aby zaroven byl tento soubor pristupny pro uzivatele root?
The most common use of the sticky bit today is on directories. When the sticky bit is set, only the item's owner, the directory's owner, or the superuser can rename or delete files.1] Takze jako vlastnik adresare muze. 2] Odstranit sticky bit a nastavit korektni opravneni na soubor.
chattr +ina soubor.
ls -l /home/user/test -rw-r--r-- 1 root root 170 Sep 30 16:29 test.txt
Tiskni
Sdílej:
ISSN 1214-1267, (c) 1999-2007 Stickfish s.r.o.