Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

extracting files from a tar archive

4 views
Skip to first unread message

Nilesh Sabnis

unread,
Jun 12, 2000, 3:00:00 AM6/12/00
to
Hi,

We have created a tar archive using the full base path( for e.g.:
/users4/test/.... ) . Now when i try to extract the file onto a
different box i am getting the error as permission denied as I don't
have the necessary rights for creating the /users4/test/... area. Can
any one help me by providing information on how to extract such archive
files.


Nilesh


Tony Walton

unread,
Jun 12, 2000, 3:00:00 AM6/12/00
to


If you're talking about a small number of files, you could use cpio.
cpio can read a tar archive and can be told to prompt for a new name for
each file as it reads it in from the archive

cpio -ivdu -H ustar -r -I the_archive_file

will do this (the -r option does the renaming, -H ustar tells cpio it's
reading a tar archive).

Since this is interactive you'll need to type a new name for each file,
so this isn't very suitable for large numbers of files. You'll need
gnutar (which strips off the leading '/' unless told not to) as
suggested by other posters or possibly a chrooted environment if you
have lots of files to restore. Or if possible recreate the archive on
the source machine using relative pathnames instead of absolute, of
course.


--
Tony

Liulei

unread,
Jun 13, 2000, 3:00:00 AM6/13/00
to
In article <3944E90D...@uk.sun.com>,

-- To extract, issue the command as super-user, it'll make every files
owned by root, all files could be created with root permission.
*********************************************************
* Liu Lei * E-mail:liu...@oaking.com *
* Shenzhen OAking Computer * or liul...@263.net *
*********************************************************


Sent via Deja.com http://www.deja.com/
Before you buy.

Tony Walton

unread,
Jun 13, 2000, 3:00:00 AM6/13/00
to
Liulei wrote:
>
> In article <3944E90D...@uk.sun.com>,
> tony....@uk.sun.com wrote:
> > Nilesh Sabnis wrote:
> > >
> > > Hi,
> > >
> > > We have created a tar archive using the full base path( for
> e.g.:
> > > /users4/test/.... ) . Now when i try to extract the file onto a
> > > different box i am getting the error as permission denied as I don't
> > > have the necessary rights for creating the /users4/test/... area.
> Can
> > > any one help me by providing information on how to extract such
> archive
> > > files.
> > >
> > > Nilesh
{snip a couple of suggestions from me}

> >
> > --
> > Tony
> >
>
> -- To extract, issue the command as super-user, it'll make every files
> owned by root, all files could be created with root permission.


Only two problems with that. Firstly, Nilesh specifically stated:

> > > I don't have the necessary rights

and secondly this runs the risk of over-writing stuff that's already
there (perhaps not in this case as Nilesh speaks of "creating" the
target area - in general however this might be a Bad Idea).

--
Tony

Joerg Schilling

unread,
Jun 13, 2000, 3:00:00 AM6/13/00
to
GNU tar does not extract POSIX tar archives correctly.

Better use star ftp://ftp.fokus.gmd.de/pub/unix/star/alpha/

In article <3944ED0D...@delphi.com>,
Joe Durusau <dur...@delphi.com> wrote:
> You might try gnu tar. It seems to me that you can tell
>it to override the destination. If you don't want to do that,
>you could create user4/test under your home dir, then copy over
>whichever executables you need, and chroot to your home. That way,
>regular tar could be fooled. In the future, you should not use
>abs pathnames for creating tar files unless you want to restore to
>the exact same place.

>Nilesh Sabnis wrote:
>> We have created a tar archive using the full base path( for e.g.:
>> /users4/test/.... ) . Now when i try to extract the file onto a
>> different box i am getting the error as permission denied as I don't
>> have the necessary rights for creating the /users4/test/... area. Can
>> any one help me by providing information on how to extract such archive
>> files.

--
EMail:jo...@schily.isdn.cs.tu-berlin.de (home) Jörg Schilling D-13353 Berlin
j...@cs.tu-berlin.de (uni) If you don't have iso-8859-1
schi...@fokus.gmd.de (work) chars I am J"org Schilling
URL: http://www.fokus.gmd.de/usr/schilling ftp://ftp.fokus.gmd.de/pub/unix

0 new messages