file permissions - neočekivano

Razne diskusije o Linuxu, neovisno o distribuciji.

Moderator/ica: Moderatori/ce

Odgovori
Avatar
stefan
Moderator
Postovi: 4366
Pridružen/a: 28 sij 2009, 18:46
Spol: M
OS: openSUSE Leap KDE

file permissions - neočekivano

Post Postao/la stefan »

Naletio sam na ovaj interesantan post na redditu
http://www.reddit.com/r/linux/comments/ ... ese_years/

Nisam imao pojma ta file permissions tako funkcionira!
I'm a long time *NIX admin and I recently discovered a serious flaw in my understanding of UNIX/Linux file and directory permissions. This is an embarrassing admission, but I'm sharing it just in case any of you have the same misunderstanding. Rather than explain, I'll just show you. Open a terminal and follow along.

Kod: Označi sve

mkdir example
ls -l
Note the permissions on "example". They should be something like 0775 (drwxrwxr-x) and the owner/group should be whatever user you're logged in with. Now create a file in the "example" directory:

Kod: Označi sve

touch example/test.txt
ls -l example/test.txt
Again, note the permissions and the owner. Now change the owner and group to "root" and then make the file "un-anything-able":

Kod: Označi sve

sudo chown root.root example/test.txt
sudo chmod 0000 example/test.txt
ls -l example/test.txt
Again (I know this is getting repetitive), note the permissions. Now, the quiz:
Who is the only user that should be able to write to the file "example/test.txt" ?
Like some other animals, the gecko can perform a neat trick when threatened by a predator: it can amputate its own tail. The dropped tail serves to distract the predator, and by losing it, the lizard can run faster.
Avatar
kepica
Postovi: 492
Pridružen/a: 26 svi 2012, 13:47
Spol: M
OS: openSUSE-kde
Lokacija: orahovica

Re: file permissions - neočekivano

Post Postao/la kepica »

zaista neočekivano !
nemaš prava da vidiš fajl, ali ga bez problema pregaziš, samo zato što imaš W prava na direktoriju.
ne bih to očekivao - ali eto, sad znam
'81: ZX81 '83:ZX spectrum '85: Apple IIe '86:C-64 *** '87:PC-XT *** '88:PC-AT *** '90:386 *** 'itd.
Odgovori