untar and change username and password

Dear all,
I would like to ask you how I can convert the file permissions of a tar.gz file.
I have one tar.gz file when I try to extract I get the following output

Cannot change ownership to uid 3361, gid 5000: Permission denied

What should I try?

Regards
Alex

Are you extracting as root?

you probably do not want to change the permissions of the *.tar.gz file. You probably want to know why you get that error message when you extract a (or more) files from that *.tar.gz file.

It means that when the tar file was crated, the file you are talking about was owned by uid 3361 and gid 5000. On extraction, tar want to restore those to the file. In which it fails for the reason the error message tells you. As vodoo already guesses, you are not extracting as root and as a normal uer you can of course not make some innocent other user owner of file at your wish. The tar was probably made by root and should be extracted by root.

I am trying to untar it as root. I believe this warning message appears as it was in another computer created.

Thanks for the explanations provided.
What should I do now?

Regards
Alex

Well, I guess the files are there, aren’t they? Please check!

Of course when omn the other system uid 3361 and guid 5000 where created (thus having also a username and a groupname) and they ae not on crated on your system (which is not unlikely), you will never see a username when you do e.g. and* ls -l,* but allways the numbers. But AFAIK the root can chown to non configured uid:groupid (i just tested this and root could).

The only thing to be checked in is where are you unpacking and what are the permissions of the directory that has these file. Can you post an

ls -l

of that directory

I do not know how many files are in the tar, but a posting of the complete output (do not forget the v option/command) might be more illustrative then just your story.

I am trying to untar it as root.

Ok, then try to extract to some other (existing) user. When doing this as root all unpacked files will be owned by root.

tar --no-same-owner -xvzf <your-tarfile.tar.gz>

Also check:

man tar

and - as hcvv suggested - the permissions of the directory where you unpack.

When doing this as root all unpacked files will be owned by root.
Yes, they will at first creation, but tar will then immediatly (before it finishes change the owner/group/timestamp to bring them back as good as possible to the state they had when archieved. From man tar:

-p, --preserve-permissions, --same-permissions
extract information about file permissions (default for superuser)
That is what it tries to do and it fails there for some reason. We have to find that reason. It could e.g. be on an NFS mounted file system (where root has no provileges). Or maybe on an NTFS file system (where uids and gids do not exist.

Hi All…
can you please help me on similar issue.
I created a file from root with below permission:
lrwxrwxrwx 1 root pdx 43 Sep 11 05:23 abc
the did cmod like below:
chmod (06551, abc);
I used tar cf command to tar it:
but while doing untar on diff machine having root machine,I am getting below ownership:
-r-sr-s–x 1 2276 pdx 1443135 Sep 11 14:54 abc

please help me why i am getting 2276 instead of root,kindly help me on the same.
Thanks-
Akshay

On 09/24/12 14:16, akshay52144 pecked at the keyboard and wrote:
> Hi All…
> can you please help me on similar issue.
> I created a file from root with below permission:
> lrwxrwxrwx 1 root pdx 43 Sep 11 05:23 abc
> the did cmod like below:
> chmod (06551, abc);
> I used tar cf command to tar it:
> but while doing untar on diff machine having root machine,I am getting
> below ownership:
> -r-sr-s–x 1 2276 pdx 1443135 Sep 11 14:54 abc
>
> please help me why i am getting 2276 instead of root,kindly help me on
> the same.
>

chmod does not change the user name, chown does. 2276 belongs to the
user pdx in this case.

Hi,

But i dint gave the command chown,how can i restore it back to root,is there any option i can use with tar while doing zipping?

Thanks-
Akshay

Ken Schneider wrote:
> On 09/24/12 14:16, akshay52144 pecked at the keyboard and wrote:
>> Hi All…
>> can you please help me on similar issue.
>> I created a file from root with below permission:
>> lrwxrwxrwx 1 root pdx 43 Sep 11 05:23 abc
>> the did cmod like below:
>> chmod (06551, abc);
>> I used tar cf command to tar it:
>> but while doing untar on diff machine having root machine,I am getting
>> below ownership:
>> -r-sr-s–x 1 2276 pdx 1443135 Sep 11 14:54 abc
>>
>> please help me why i am getting 2276 instead of root,kindly help me on
>> the same.
>
> chmod does not change the user name, chown does. 2276 belongs to the
> user pdx in this case.

Ken, I’m not sure why you believe that? There is certainly a group pdx
but we have no evidence that a user called pdx even exists, let alone
that their uid is 2276.

akshay52144, the initial directory listing shows that abc is a symbolic
link. What are the attributes of the file that it links to? Those should
match the ones of the tar copy.