Re: restoring FC1 to *new* partition from tar archive

From: Luciano Miguel Ferreira Rocha (strange_at_nsk.no-ip.org)
Date: 05/11/04

  • Next message: Luciano Miguel Ferreira Rocha: "Re: recommending reiserfs?"
    Date: Mon, 10 May 2004 23:47:56 +0100
    To: "Joe(theWordy)Philbrook" <jtwdyp@ttlc.net>, For users of Fedora Core releases <fedora-list@redhat.com>
    
    

    On Sun, May 09, 2004 at 11:54:47PM -0400, Joe(theWordy)Philbrook wrote:
    > Now I'm getting a little confused... I found two relevant items under
    > info tar.
    >
    > => `--numeric-owner'
    > => This option will notify `tar' that it should use numeric user and
    > => group IDs when creating a `tar' file, rather than names.

    There's also:
    `--numeric-owner'
         The `--numeric-owner' option allows (ANSI) archives to be written (1)
         without user/group name information or such information to be
         ignored when extracting. It effectively disables the generation
         and/or use of user/group name information. This option forces
         extraction (2) using the numeric ids from the archive, ignoring the
         names.

    Two things:
    1) If used when creating archives, the user/group information stored in
    the archive for files will be only numeric
    2) If used when extracting, it will use only the numeric information and
    disregard the names.

    It continues:
         This is useful in certain circumstances, when restoring a backup
         from an emergency floppy with different passwd/group files for
         example. It is otherwise impossible to extract files with the
         right ownerships if the password file in use during the extraction
         does not match the one belonging to the filesystem(s) being
         extracted. This occurs, for example, if you are restoring your
         files after a major crash and had booted from an emergency floppy
         with no password file or put your disk into another machine to do
         the restore.

    Etc., please refer to the info file. (There's a more informational section
    about the option later in the file.)

    > Which option isn't even mentioned in man tar. Now here is the part I
    > don't understand. If it's supposed to be more reliable when extracting
    > to a different system, How would it deal with file belonging to
    > user=goodDube has UID=1001 on the source file system when on the
    > destination file system UID=1001 is held by user=EvilTwin???

    If the option --numeric-owner is used:
    - the file ownership is changed to uid 1001, that belongs to EvilTwin

    Without the option (and with the information that 1001=goodDube in the
    archive):
    1) if a goodDube user also exists in the destination system, lets say with
    uid=1010:
      - the file ownership is changed to goodDube's, 1010. That's what you
        usually want
    2) if such user doesn't exist:
      - the file ownership is changed to uid 1001 (the only usable information),
        that belongs to EvilTwin

    Why you don't want 1 in your case:
    You're creating a full backup. When you restore it, you're going to use it
    as is, with the *stored* passwd and group files. *Not* the ones being used
    in the system while you extracted the files.

    > -> `--same-owner'
    > -> When extracting an archive, `tar' will attempt to preserve the
    > -> owner specified in the `tar' archive with this option present.
    > -> This is the default behavior for the superuser; this option has an
    > -> effect only for ordinary users.
    >
    > Which option is listed (sparsely) in man tar, and sounds like it will
    > try to keep the same owner, based on the user name of owner.

    Tar will always do that, when it can. Normal users, though, can't change
    owners (in most systems), and really don't want to. Otherwise, the
    extracted files would probably be useless to you, as they probably belong
    to a different user in the system where the archive was created.

    As you're extracting as superuser (so that you *can*, on linux, create
    files for different users, and, on all systems, create special files), you
    don't need to worry about this option.

    <snip (I hope already answered by above)>
    >
    > If I wanted to use the --numeric-owner option, do I need to use it
    > during both the "tar -c" AND the "tar -x" process, or only during the
    > extraction?

    Only once. If used when creating, it will have no effect when extracting,
    as the information isn't stored.

    But you probably want to use on extraction, as the added information to
    tar could be usefull in other scenarios.

    Regards,
    Luciano Rocha

    -- 
    Consciousness: that annoying time between naps.
    -- 
    fedora-list mailing list
    fedora-list@redhat.com
    To unsubscribe: http://www.redhat.com/mailman/listinfo/fedora-list
    

  • Next message: Luciano Miguel Ferreira Rocha: "Re: recommending reiserfs?"

    Relevant Pages

    • Re: R: Linux kernel source archive vulnerable
      ... I didn't tell tar to use some special ... I'm not suggesting extracting random archives as root. ... Keep in mind that there are good reasons to extract the Linux tarball ...
      (Linux-Kernel)
    • Re: [SLE] tar.gz
      ... > Could someone give me a detailed instructions on to install Tar.gz ... TAR is an archiving format--a way to collect multiple files ... be built by extracting the content, changing to the top directory into ...
      (SuSE)
    • Re: Extracting individual Files via tar
      ... actually had the positions of the archive and the file I was extracting ... > tar -tzf archive.tgz ... you didn't specify an archive so it ... To unsubscribe, ...
      (freebsd-questions)
    • Re: GNU tar and the setuid bit
      ... > If running as the root user tar restores the original permissions to ... > extracted files is the root user. ... advisable to use this along with -o when extracting random archives as root. ...
      (Bugtraq)
    • Re: openBSD 3.7 tar command - tar: Invalid header, starting valid header search
      ... tar: Invalid header, starting valid header search. ... But listing & extracting works just fine. ... I ran md5sum command on all files - extracted using openBSD 3.7 tar AND ... by two null somethings, and those archives only have one, but since EOF ...
      (comp.unix.bsd.openbsd.misc)