I understand now that I can't give away files Using chown as I am a normal user and not the one with root permissions. Now my problem is I have a whole bunch of files with write permissions on them and I am not root. But yet being affected by space issue.

Now I can zip the files, but the minute I zip the files I become the owner. After zipping, I still want the owner to be the one who created the file and not me. Any way that is feasible?

  • 1
    AFAIK zip does not have any concept of ownership or permissions, try using tar instead.
    – Sammitch
    Commented Oct 14, 2015 at 23:46
  • @Sammitch: can You please elaborate. Never used Tar before
    – hemanth
    Commented Oct 14, 2015 at 23:57
  • computerhope.com/unix/utar.htm
    – Sammitch
    Commented Oct 15, 2015 at 0:50

1 Answer 1


If you use tar you can preserve the ownership of files. However, unless you're root when extracting the file from the tar file, the ownership won't be restored if you don't have the permission.
Note that tar does not compress, it only archives.

As an added bonus, tar will preserve the permissions of the files and directory.

To use tar and make sure to preserve all ownership and permissions:

tar cpf ~/myarchive.tar folder_to_archive

(take care that tar store the relative or absolute path as well. When extracting if you are a standard user, tar will extract the files relatively to the current folder. But if you are root and you used an absolute path, tar will extract them using the absolute path, potentially overwriting existing files. Read tar documentation and tutorials for all possibilities regarding absolute or relative paths.)

(optionally you can then compress your tar archive using whatever compression tool. Examples: gzip ~/myarchive.tar or xz ~/myarchive.tar etc.)

To extract your files:

tar --same-owner xpf ~/myarchive.tar

As a normal user this will extract the files in the current folder, permissions will be kept but user ownership will be lost and group ownership might be lost if you are not part of the group.

But to have all permissions and ownership set correctly you will need to either call this command via sudo or execute it as a user with enough privileges (usually root).

PS: if on Linux and using the GNU tar, you can preserve in addition some metadata such as ACL, xattr or SELinux. But you need to use special flags to let tar know you want this data to be archived as well. See the GNU tar documentation.

You must log in to answer this question.

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