Using File Explorer - Extract 7z and the folders are 700, Extract ZIP and the folders are 755

SYSTEM INFORMATION
OS type and version Ubuntu Linux 22.04.4
Webmin version 2.105
Usermin version 2.005
Virtualmin version 7.10.0
Theme version 21.09.5
Package updates 12 package updates are available

I installed the p7zip-full so I can extract .7z files.

I can now extract 7z files in the file explorer but the folders always extract with a CHMOD of 700.

When i extract a .zip file on the server using the file explorer the folders have the correct permissions of 755.

So my questions are:

  • Is this an issue with Virtualmin/Webmin or 7Zip?
  • Is there some settings for 7Zip to change the default folder permissions?
  • Have I don’t something wrong?

7z can preserve the mode of files. So, presumably the files were 700 when you archived them?

I extracted the archive to my windows desktop and then re-7zip and I still had the same problem.

I did not make the original archive, this came from my clients hosting provider and I assume it was created on the Linux machine where the files are present.

But I will double check this to make sure.

To confirm the issue I did the following on my windows PC

  • I created some temp folders with some text files in
  • zipped them up with 7zip
  • transfer them to my virtual server
  • i unzipped them

The results are still the same, the folder have 700 permissions

Take a look at Unpacking with 7z messes up permissions for resulting files. - General Support - Unraid

So this means the file is not broken and it is an issue with the extraction.

Does virtualmin/webmin do any post permission processing and this procedure is not happening for 7z?

Hmm, that makes it sound like the opposite. That 7z doesn’t preserve permissions. Which is bonkers. It’s not a format I ever use (it’s inferior to several newer compression formats, that are faster and more efficient), so I don’t know how it behaves, but I searched yesterday and got the impression it did store permissions.

Of course not. It runs the program to perform the operation. We didn’t reimplement 7z (or zip or gzip or bz2 or xz or whatever), we just run the command to do the thing, and I guess this is what it spits out? Do you get something different when you uncompress it using the command line tool as the same user?

I don’t see any options about permissions, so I dunno. Ubuntu Manpage: 7z - A file archiver with high compression ratio format

And, from that doc:

DO NOT USE the 7-zip format for backup purpose on Linux/Unix because :
        - 7-zip does not store the owner/group of the file.

So, maybe do not use 7-zip for backup purposes on Linux/UNIX. Just a thought.

So, maybe do not use 7-zip for backup purposes on Linux/UNIX. Just a thought.

I definitely wont. I will look around on the internet ans see if anyone else has identified this permission issue. For now, i will just extract and then zip up before transferring to my Virtualmin and extracting it there.

Some people put it in a tar file and then compress that with 7Zip so as to keep permissions.

You can set permissions in the File Manager, too.

I have extracted my testfolder.7z from the Terminal using ‘7z e testfolder.7z’ and this created folders with the permissions 700.

I asked the company that sent me this about the permission issue and I am interested to know what their response is.

What would you expect? 7z does not recreate file permissons on extraction

when i extracted a zip i got 0644 and 0755 and that is what I expected. These are the default permissions for CGI, FastCGI and suExec environments I think.

It might be that 7z was around from before suExec and it is still using permissions from that error.

remember this ? Unpacking with 7z messes up permissions for resulting files. - General Support - Unraid ? It states that file permissions are not restored, this doesn’t make any difference if the archive was restored from a gui or the command line … 7z does not store this in the archive. Just a quick chmod/chown fixes it, as Joe pointed out don’t use this format of archive on anything critical. Zip on the other hand appears to respect file permissions

Zip and 7z aren’t the same thing and they have different behavior. :man_shrugging:

Since we have nothing to do with the problem and you can set permissions in the File Manager after extraction, I’ll call this one solved. I don’t think we should try to guess what the user wants with regard to permissions as that’d be very dangerous.

1 Like