Find the answer to your Linux question:
Results 1 to 4 of 4
Believe me, I've looked, but I can't find an answer to this anywhere quickly... I have tarballs which have the wrong permissions and owners/groups embedded. When I extract the files, ...
  1. #1
    Just Joined!
    Join Date
    Dec 2008
    Posts
    19

    Tar help with permissions

    Believe me, I've looked, but I can't find an answer to this anywhere quickly...

    I have tarballs which have the wrong permissions and owners/groups embedded.

    When I extract the files, I want to blanket apply a particular user, group, and permissions to files and directories.

    Is there a way to do this?

    I have tried

    tar --owner=newowner --group=newgroup --mode=ugo=rwX -xf archive.tar

    but it just extracts the files ignoring any changes to permissions.

    Steve

  2. #2
    Linux Engineer Kieren's Avatar
    Join Date
    Aug 2007
    Location
    England
    Posts
    845
    Does the user running the tar command have write access to the files?
    Linux User #453176

  3. #3
    Just Joined!
    Join Date
    Dec 2008
    Posts
    19
    Yes, it's me

    I'm taring up a pile of files off my mac, which obviously has nothing in common in terms of users/groups with my linux web server.

    Obviously the ID's associated with my mac account user/group are nonsense once the file is unpacked on the linux box.

    Does that make sense?

  4. #4
    Linux Engineer Kieren's Avatar
    Join Date
    Aug 2007
    Location
    England
    Posts
    845
    Quote Originally Posted by santrix View Post
    tar --owner=newowner --group=newgroup --mode=ugo=rwX -xf archive.tar
    I'm not sure if this is causing the error must normally Linux commands have a space after a flag rather than an = sign (not always, for example dd doesn't)

    You could try:

    Code:
    tar --owner newowner --group newgroup --mode 744 -xf archive.tar
    Your mode may be okay but I have never used that method before. I assume you replace newowner and newgroup with ones that exist on your system too?
    Last edited by Kieren; 08-05-2009 at 02:50 PM. Reason: formatting and typo
    Linux User #453176

Posting Permissions

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