Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

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>
share|improve this answer
    
Actually, tar handles it properly in either case. but the ZIP is still a problem. –  romaninsh May 27 '11 at 12:25
    
Try creating the zip with something like Ant then? See updated answer for details –  Gagravarr May 27 '11 at 12:44
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.