You are not logged in.

#1 2008-10-17 06:24:54

solarwind
Member
From: Toronto
Registered: 2008-03-18
Posts: 546

Permissions

If user Joe tars up a directory containing the following files:

x.txt owned by root -rw-------
y.txt owned by Joe -rw-------
z.txt owned by Jane -rw-------

and gives the tarball (probably owned be Joe) to his friend Jack, when Jack untars the tarball, who will own the files? Will they all belong to Jack or will the permissions be preserved? Can Jack open up x.txt (owned by root)?

Offline

#2 2008-10-17 07:40:43

bender02
Member
From: UK
Registered: 2007-02-04
Posts: 1,328

Re: Permissions

Why don't you try?

1) Joe won't be able to tar up x.txt, since it's not readable for him
2) see 'man tar' -> flag '-p'
3) when untarring, Jack will be able to preserve only those permissions that he can regularly chmod/chown, so on most systems he wouldn't be able to create files owned by other users

EDIT: I guess the message is that untarring for the system is just 'the process tar, run with these and these privileges, is creating, chmodding and chowning files. So that should give you an idea what's possible and what's not.

Last edited by bender02 (2008-10-17 07:43:21)

Offline

#3 2008-10-17 07:52:19

solarwind
Member
From: Toronto
Registered: 2008-03-18
Posts: 546

Re: Permissions

bender02 wrote:

Why don't you try?

1) Joe won't be able to tar up x.txt, since it's not readable for him
2) see 'man tar' -> flag '-p'
3) when untarring, Jack will be able to preserve only those permissions that he can regularly chmod/chown, so on most systems he wouldn't be able to create files owned by other users

EDIT: I guess the message is that untarring for the system is just 'the process tar, run with these and these privileges, is creating, chmodding and chowning files. So that should give you an idea what's possible and what's not.

Ok so if Joe tars up a directory owned by Joe and gives it to Jack, can Jack open those files?

Offline

#4 2008-10-17 08:14:46

bender02
Member
From: UK
Registered: 2007-02-04
Posts: 1,328

Re: Permissions

Again, why the heck don't you try? [EDIT: don't take me wrong, what i'm just trying to say is that when you figure out something for yourself, without someone telling you, you actually learn a lot more and better.]

solarwind wrote:

Ok so if Joe tars up a directory owned by Joe and gives it to Jack, can Jack open those files?

If the permissions on the tar file itself allow Jack read the tarball, then yes, jack can open these files. Untarring that tar file would by default create the files owned by Jack.

An addition to 2) in my previous post - also see the flag '--same-owner'.

Last edited by bender02 (2008-10-17 08:26:17)

Offline

Board footer

Powered by FluxBB