I have zip file created on windows and I want to extract it on Linux. For extracted files, I want to have permissions 644. However, extracting files end with 770.

I have tried

umask 644
unzip update.zip -d . 

But it has no effect and permissions of extracted files are still 770.

  • Have you ever found a solution for this? It would seem unzip is unaffected by umask. One could of course chmod after extracting, but that either requires a separate folder files are extracted to or knowledge of archive contents.
    – Fonic
    Aug 28 at 18:57

1 Answer 1


Your umask mode is wrong.

# umask 644
# touch test1
# stat -c "%a %n" test1
22 test1

To get resulting files with 644, you need to set umask 0022.

# umask 0022
# touch test2
# stat -c "%a %n" test2
644 test2

From man umask:

umask() sets the calling process's file mode creation mask (umask) to mask & 0777 (i.e., only the file permission bits of mask are used), and returns the previous value of the mask.

  • Even with the correct umask 0022, it would seem unzip is unaffected.
    – Fonic
    Aug 27 at 15:35

You must log in to answer this question.

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