LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 01-31-2017, 10:53 AM   #16
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,792

Rep: Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306

I told you already: during creation of an archive the -p flag has no any meaning. Tar always stores permissions, owner/group information inside the archive.
You can check it using: tar tvf <tarfile>.
The flags -p, --no-same-permissions, --no-same-owner and similar will only describe how tar tries to restore the original permissions/ownership.
These attributes will be restored according to the rights of the current user (so root will be able to restore everything, but regular users are not allowed to do that).
Also you can specify if umask should or should not be taken into account.
 
Old 02-03-2017, 04:55 AM   #17
elija
Member
 
Registered: Jul 2008
Location: The garden of England. Technically, the compost heap.
Distribution: openSUSE Tumbleweed
Posts: 60

Original Poster
Rep: Reputation: 21
Quote:
Originally Posted by pan64 View Post
I told you already: during creation of an archive the -p flag has no any meaning. Tar always stores permissions, owner/group information inside the archive.
It's strange that the man page implies that it does, along with every tutorial and forum post I've been reading. That said, what is actually happening when I test things out agrees with you.

So the question remains, can tar be used in such a way that extracted files do not have their execute bit set?
 
Old 02-03-2017, 05:10 AM   #18
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,792

Rep: Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306
that was already answered, tar itself cannot handle it. You have 3 options:
1. modify files/permission before you create the archive
2. modify files/permissions after extraction
3. use umask, but you can use only one umask settings for both files and directories (so if you want to remove x, you will remove it from dirs too)
4. bonus: reimplement tar (probably you can take perl/python/whatever module, not only the original c code)
 
  


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
tar: --no-same-permissions does not work stateless Linux - Software 1 12-31-2013 06:51 PM
tar not preserving permissions? BassKozz Linux - Newbie 6 06-03-2009 12:36 PM
BackUp & Restore with TAR (.tar / .tar.gz / .tar.bz2 / tar.Z) asgarcymed Linux - General 5 12-31-2006 02:53 AM
Tar permissions exvor Linux - Software 5 05-31-2005 02:54 PM
tar with permissions alaios Linux - General 2 09-23-2004 04:08 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:08 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