Click to See Complete Forum and Search --> : will a gziped directory preserve chmods ?


Donovan
11-30-2000, 04:24 PM
Hi, if I gzip a directory, will the chmod be kept, so If I restore the directory, it will keep all the chmods ?

Thanks,
Donov

Sweede
11-30-2000, 04:42 PM
only if you use -a (i think)

but then you can always type
man tar
man gzip
man bzip
man etc, etc

klamath
11-30-2000, 07:16 PM
You can't gzip a directory.

------------------
- Klamath
Get my GnuPG Key Here (http://klamath.dyndns.org/mykey.asc)
Looking for an open source project to contribute to? Check out the Better Bulletin Board (http://bbb.sourceforge.net)

Donovan
11-30-2000, 08:56 PM
So will tar do ?
If I tar a directory, will the permissions be preserved ?

Thanks,
Donov

klamath
11-30-2000, 10:11 PM
Take a look @ `info tar`. From a brief glance, it appears that when tar makes archives, it preserves the permissions. By default, it changes permissions when extracting the archive -- but if you give it the flag --preserve-permissions , it will keep them the same.

------------------
- Klamath
Get my GnuPG Key Here (http://klamath.dyndns.org/mykey.asc)
Looking for an open source project to contribute to? Check out the Better Bulletin Board (http://bbb.sourceforge.net)

SubPar
11-30-2000, 10:12 PM
Yes. Tar keeps permissions and attributes on files and directories. Once you've got the directory tarred up, you can gzip it. (Actually, tar can automatically gzip a tarball when you create it. Read the man page for tar for details)

Craig McPherson
11-30-2000, 11:25 PM
All gzip does is compress single files, so it's not an issue. You have to use tar to glom them together into a single file, and yes, you have to pass certain options to tar to make sure it preserves permission and ownership exactly.