LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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


Reply
  Search this Thread
Old 03-21-2014, 03:51 PM   #1
dhinged
LQ Newbie
 
Registered: Mar 2014
Posts: 6

Rep: Reputation: Disabled
Best way to preserve ownership in tar compress?


Is there an easier way than using --same-owner with tar czpf? I'm not finding it anywhere and it's a pain to type every time as I use it often. Also it needs to preserve ownership on extract.
 
Old 03-21-2014, 04:16 PM   #2
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,779

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
Usually you don't need to specify that. In Linux, you have to be root in order to create files owned by anyone but yourself, and when tar is run by root it defaults to preserving ownership and permissions.
 
Old 03-21-2014, 05:05 PM   #3
dhinged
LQ Newbie
 
Registered: Mar 2014
Posts: 6

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by rknichols View Post
Usually you don't need to specify that. In Linux, you have to be root in order to create files owned by anyone but yourself, and when tar is run by root it defaults to preserving ownership and permissions.
OK thanks. I figured it would do this automatically at least for the files that shared my group and had group read/write permissions on them.
 
Old 03-21-2014, 05:22 PM   #4
mreff555
Member
 
Registered: Sep 2011
Location: Philly
Distribution: Gentoo
Posts: 473

Rep: Reputation: Disabled
Quote:
Originally Posted by dhinged View Post
Is there an easier way than using --same-owner with tar czpf? I'm not finding it anywhere and it's a pain to type every time as I use it often. Also it needs to preserve ownership on extract.
rknichols is right but just in case the -p flag preserves permissions.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
failed to preserve ownership operation not permitted yogks Linux - Software 1 11-27-2008 04:54 PM
preserve ownership error while using commands ravi_chobey Linux - Hardware 3 03-26-2008 04:59 AM
Make KDE/Konqueror preserve time, ownership on file copy tisource Linux - Software 2 06-27-2006 01:23 PM
Preserve the ownership juno Linux - General 1 01-16-2003 01:38 PM
preserve the ownership juno Linux - General 5 01-08-2003 11:01 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:46 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration