amit0 ~ # tar --version
tar (GNU tar) 1.20
I read in the manpage:
<QUOTE>
--owner USER
change owner of extraced files to USER
<QUOTE/>
Nevertheless I can't get --owner and --group to work when extracting an
archive. Files in archive are owned by root:
amit0 ~ # mkdir /tmp/source
amit0 ~ # touch /tmp/source/file
amit0 ~ # find /tmp/source/ -ls
235609346 0 drwxr-xr-x 2 root root 17 Jul 30 10:57
/tmp/source/
235609347 0 -rw-r--r-- 1 root root 0 Jul 30 10:57
/tmp/source/file
amit0 ~ # tar czf tar.tar.gz -C /tmp source
amit0 ~ # tar tvf tar.tar.gz
drwxr-xr-x root/root 0 2009-07-30 10:57 source/
-rw-r--r-- root/root 0 2009-07-30 10:57 source/file
amit0 ~ # rm -fr /tmp/dest/*
amit0 ~ # tar xzf tar.tar.gz --owner amitds --group amitds -C /tmp/dest/
amit0 ~ # find /tmp/dest/ -ls
269537327 0 drwxrwxr-x 3 root root 19 Jul 30 11:01
/tmp/dest/
302673585 0 drwxr-xr-x 2 root root 17 Jul 30 10:57
/tmp/dest/source
302673586 0 -rw-r--r-- 1 root root 0 Jul 30 10:57
/tmp/dest/source/file
amit0 ~ # id amitds
uid=1014(amitds) gid=1022(amitds) groups=1022(amitds)
a/m options do seem to work when archiving:
amit0 ~ # chown -R root:root /tmp/source/
amit0 ~ # tar czf tar.tar.gz -C /tmp source --owner amitds --group amitds
amit0 ~ # tar tvf tar.tar.gz
drwxr-xr-x amitds/amitds 0 2009-07-30 10:57 source/
-rw-r--r-- amitds/amitds 0 2009-07-30 10:57 source/file
But then I don't need to apply those options upon extraction.
Please advise. Is there a method of applying ownership on-extraction? Is
the manpage incorrect?
Amit