Help needed for tar archive creation with changed UID/GID
Hello, I am a newbie to this mailing list, i have seen in some mail discussions about a tar archive creation by forcibly setting the UID/GID to a specific user (say root). Te code mentioned goes like this: tar = tarfile.open("foo.tar.gz", "w:gz") for filename in filenames: tarinfo = tar.gettarinfo(filename) if tarinfo.isreg(): fobj = open(filename) else: fobj = None tarinfo.uid = 0 tarinfo.gid = 0 tar.addfile(tarinfo, fobj) tar.close() But this is not really working for me as when i am trying to un-tar or un-compress contents to a new directory and contents still have diff GID & UID in the long listing of directory. Can somebody suggest an alternative or a working case if already changes are done here. Thanks in advance. Best regards, Bheemesh
bheemesh v wrote:
I am a newbie to this mailing list, i have seen in some mail discussions about a tar archive creation by forcibly setting the UID/GID to a specific user (say root).
Note that this is the mailing list about core development of the CPython interpreter, not about general Python development. Please refer your request to python-list@python.org or tutor@python.org instead. Stefan
bheemesh v wrote:
Hello,
I am a newbie to this mailing list, i have seen in some mail discussions about a tar archive creation by forcibly setting the UID/GID to a specific user (say root).
Hello Bheemesh, This mailing list is for the development of Python, not for developing *with* Python. There are other more appropriate mailing lists where you will hopefully get helpful answers: The Python tutor list http://mail.python.org/mailman/listinfo/tutor The comp.lang.python newsgroup The email gateway: http://mail.python.org/mailman/listinfo/python-list A google groups interface: http://groups.google.com/group/comp.lang.python/topics?lnk=li&hl=en&pli=1 All the best, Michael Foord
Te code mentioned goes like this: tar = tarfile.open("foo.tar.gz", "w:gz") for filename in filenames: tarinfo = tar.gettarinfo(filename) if tarinfo.isreg(): fobj = open(filename) else: fobj = None
tarinfo.uid = 0 tarinfo.gid = 0 tar.addfile(tarinfo, fobj) tar.close()
But this is not really working for me as when i am trying to un-tar or un-compress contents to a new directory and contents still have diff GID & UID in the long listing of directory.
Can somebody suggest an alternative or a working case if already changes are done here.
Thanks in advance.
Best regards, Bheemesh ------------------------------------------------------------------------
_______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/fuzzyman%40voidspace.org.u...
participants (3)
-
bheemesh v
-
Michael Foord
-
Stefan Behnel