folders and files would save chmod settings?
permissions for files / directories are stored by the tar program inside the archive. accordingly, when unpacking the archive, the tar program assigns to each created file / directory exactly those rights that were recorded inside the archive.
Do folders and files have a specific owner-user?
The tar program (at least the implementation from the gnu project) when creating an archive saves information about the owner / group of files / directories not only in numerical form ( uid / gid ), but also in the form of strings. so that the lines are not saved, you can use the option --numeric-owner .
when unpacking, running on behalf of an ordinary user, this information does not have a (significant) effect, because an ordinary user can create files / directories belonging only to him.
when unpacking, running on behalf of the superuser (whose uid is zero; usually the root is assigned to the username), there is no such restriction: the process can create files / directories belonging to the user / group with any uid / gid .
accordingly, if the archive contains lines with the names of the owners / groups, then if there is a user / group with the same name in the system where unpacking is performed, these names will be used.
if there is no corresponding user / group name in this system (or the names were not saved at all due to the aforementioned option --numeric-owner ), then the numerical values stored in the archive will be used. completely different strings with the names of users / groups can be assigned to these numerical values of uid / gid . you, apparently, and faced exactly such a situation.
There is only one way out: before unpacking, you need to create in this system users / groups with the names that are stored inside the archive.
You can see these names by adding the -v option when viewing the contents of the archive (and the view itself is the -t option):
$ tar -t -v -f архив
example output:
-rw-r--r-- user/group 0 2016-11-11 12:41 file
which shows that the file file belongs to the user user group .
man tardid not try? there are many interesting keys. In general, if you deploy tar as root, by default it uses the owners and rights from the archive - Mikeman tarsays that the key is--owner=NAME- Mikeman...--owneradds files with a specific user to the archive. And it extracts either with the same one in the archive (--same-owner or when executed as root), or with the current user (--no-same-owner). So, it is worthwhile to perform unarchiving not under the root, but under the user www-data. Those. if the script runs under root thensu www-data -c 'tar -xzvf file'- Mike