LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
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, 04:51 PM   #1
dhinged
LQ Newbie
 
Registered: Mar 2014
Posts: 4

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, 05:16 PM   #2
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 3,139

Rep: Reputation: 1349Reputation: 1349Reputation: 1349Reputation: 1349Reputation: 1349Reputation: 1349Reputation: 1349Reputation: 1349Reputation: 1349Reputation: 1349
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, 06:05 PM   #3
dhinged
LQ Newbie
 
Registered: Mar 2014
Posts: 4

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, 06: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


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 05:54 PM
preserve ownership error while using commands ravi_chobey Linux - Hardware 3 03-26-2008 05:59 AM
Make KDE/Konqueror preserve time, ownership on file copy tisource Linux - Software 2 06-27-2006 02:23 PM
Preserve the ownership juno Linux - General 1 01-16-2003 02:38 PM
preserve the ownership juno Linux - General 5 01-09-2003 12:01 AM


All times are GMT -5. The time now is 07:37 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration