2

I am distributing packaged files in ZIP format. I use the following to create:

zip -r distr.zip files/

When expanded on other UNIX system files preserve their permissions as they were when I packed them. I am willing to avoid storing permission information.

My question is: Is it possible to do so? I'm using info-zip 3.0

The problem is that on my system i use umask 0002 and files are writable for groups. However when expanded on other systems, groups write permission is not desired. I could remove group write permissions, but then it wouldn't work on my system.

1 Answer 1

0

I can't spot a suitable option to control permissions when unzipping

Using tar however, there's the option --no-same-permissions which may help, the manual page says:

 --no-same-permissions
       apply the user's umask when extracting permissions from the archive

Does that do the trick for you?

Alternately, if you want to use a zip file, you might want to try creating it with a different program. For example, Apache Ant gives you full control over the permissions of files and directories it zips up - http://ant.apache.org/manual/Types/zipfileset.html has details. For example, you could do something like:

<zip destfile="dist.zip">
   <zipfileset dir="dist" filemode="664" dirmode="755" />
</zip>
2
  • Actually, tar handles it properly in either case. but the ZIP is still a problem.
    – romaninsh
    Commented May 27, 2011 at 12:25
  • Try creating the zip with something like Ant then? See updated answer for details
    – Gagravarr
    Commented May 27, 2011 at 12:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .