Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place! |
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
06-03-2009, 11:46 AM
|
#1
|
|
Member
Registered: Dec 2008
Distribution: Ubuntu 8.10
Posts: 35
Rep:
|
tar not preserving permissions?
I backed up using:
Code:
tar -cvpzf foo.tgz .
I restored using:
Code:
tar -C /home/user/restore/ -xvzf foo.tgz
and the permissions aren't kept, what gives?
When I try and run with -p on restore I get:
Code:
tar -C /home/user/restore/ -xvzfp foo.tgz
tar: p: Cannot open: No such file or directory
tar: Error is not recoverable: exiting now
tar: Child returned status 2
tar: /home/user/BACKUPS/foo.tgz: Not found in archive
tar: Error exit delayed from previous errors
p.s. I transfered the backup from one computer to another (different users).
TiA,
-BassKozz
Last edited by BassKozz; 06-03-2009 at 11:56 AM.
|
|
|
|
06-03-2009, 11:53 AM
|
#2
|
|
Member
Registered: Jun 2009
Distribution: slackware
Posts: 123
Rep:
|
Hello.
When you are extracting you are omitting the "p" option.
|
|
|
|
06-03-2009, 11:56 AM
|
#3
|
|
Member
Registered: Jun 2009
Location: Spain
Distribution: Various, Ubuntu, Fedora, Open Solaris, Solaris, RHEL, CentOS
Posts: 62
Rep:
|
Hi
You need to use the p option in the extraction to preserve the archived permissions
Code:
tar -C /home/user/restore/ -xvpzf foo.tgz
Hope this helps, if not, please provide more detail about the permissions, owner and group settings for the files with
.
Cheers
Emma
|
|
|
|
06-03-2009, 12:03 PM
|
#4
|
|
Member
Registered: Jun 2009
Distribution: slackware
Posts: 123
Rep:
|
Code:
tar xvfp foo.tgz -C /home/user/restore/
|
|
|
|
06-03-2009, 12:04 PM
|
#5
|
|
Gentoo support team
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 3,971
|
Quote:
Originally Posted by BassKozz
I backed up using:
Code:
tar -cvpzf foo.tgz .
I restored using:
Code:
tar -C /home/user/restore/ -xvzf foo.tgz
and the permissions aren't kept, what gives?
When I try and run with -p on restore I get:
Code:
tar -C /home/user/restore/ -xvzfp foo.tgz
tar: p: Cannot open: No such file or directory
tar: Error is not recoverable: exiting now
tar: Child returned status 2
tar: /home/user/BACKUPS/foo.tgz: Not found in archive
tar: Error exit delayed from previous errors
p.s. I transfered the backup from one computer to another (different users).
TiA,
-BassKozz
|
-f is the last. Whatever there is after that is supposed to be the file name.
|
|
|
|
06-03-2009, 12:23 PM
|
#6
|
|
Member
Registered: Dec 2008
Distribution: Ubuntu 8.10
Posts: 35
Original Poster
Rep:
|
Quote:
Originally Posted by i92guboj
-f is the last. Whatever there is after that is supposed to be the file name.
|
That was it... {DOH} 
Thanks i92guboj.
Quote:
Originally Posted by noctilucent
Code:
tar xvfp foo.tgz -C /home/user/restore/
|
Interestingly enough "f" doesn't have to be last if you don't use a dash.
For Example:
tar xvfp foo.tgz = WORKS
tar -xvfp foo.tgz = DOES NOT WORK
tar -xvpf foo.tgz = WORKS
Wounder why that is?
Last edited by BassKozz; 06-03-2009 at 12:30 PM.
|
|
|
|
06-03-2009, 12:36 PM
|
#7
|
|
Member
Registered: Jun 2009
Distribution: slackware
Posts: 123
Rep:
|
From "tar.c" [GNU Tar 1.22]:
Code:
static void
decode_options (int argc, char **argv)
{
/* -- code removed [noctilucent] -- */
/* Convert old-style tar call by exploding option element and rearranging
options accordingly. */
if (argc > 1 && argv[1][0] != '-')
{
/* -- code removed [noctilucent] -- */
Last edited by noctilucent; 06-04-2009 at 02:15 PM.
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 09:33 AM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|