Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: untar and change username and password

  1. #1

    Default 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

  2. #2
    Join Date
    Jan 2009
    Location
    Switzerland
    Posts
    1,529

    Default Re: untar and change username and password

    Are you extracting as root?
    Technology is 'stuff that doesn't work yet.' -- Bran Ferren

  3. #3
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    25,002

    Default Re: untar and change username and password

    Quote Originally Posted by alaios View Post
    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
    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.
    Henk van Velden

  4. #4

    Default Re: untar and change username and password

    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

  5. #5
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    25,002

    Default Re: untar and change username and password

    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
    Code:
    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.
    Henk van Velden

  6. #6
    Join Date
    Jan 2009
    Location
    Switzerland
    Posts
    1,529

    Default Re: untar and change username and password

    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.

    Code:
    tar --no-same-owner -xvzf <your-tarfile.tar.gz>
    Also check:

    Code:
    man tar
    and - as hcvv suggested - the permissions of the directory where you unpack.
    Technology is 'stuff that doesn't work yet.' -- Bran Ferren

  7. #7
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    25,002

    Default Re: untar and change username and password

    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.
    Henk van Velden

  8. #8

    Default Re: untar and change username and password

    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

  9. #9

    Default Re: untar and change username and password

    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.

  10. #10

    Default Re: untar and change username and password

    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

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •