Error running the tar command with 'P' parameter from SUA on Windows 2008 R2

Recently we got a case where customer was getting error while running the tar command with the P parameter. Customer was getting the error while running the command as a User who is part of the Domain user group. The O/S in question is Windows 2008 R2 x64 bit.

On troubleshooting we found that the command is failing because, the ownership of the tar files was with Administrator user and the only way the domain user get the permission is either through group or through others. In both the cases it does not has write permission and only has read and execute permission. Hence it fails. Also, when you run the script in Interix, it follows the Unix permission style and looks for the permission that a User/group/other has.

Note:

As per man pages from Windows 2003 R2 for -p option:

Preserve user identifier (ID), group ID, file mode, access and modification times.

As per man pages from Windows 2008 R2 for –p option:

Preserve user and group ID as well as file mode regardless of the current umask(2). The setuid and setgid bits are only preserved if the user is the superuser. Only meaning-ful in conjunction with the -x flag.

To be able to use the -p option on Interix, we need to make sure that your tar file is created on Windows system that is part of the same domain because Interix uses Windows SID which are not same as *nix uid/gid identifiers.

The way to get it work would be setting up the group permission properly.