LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Enterprise Linux Forums > Linux - Enterprise
User Name
Password
Linux - Enterprise This forum is for all items relating to using Linux in the Enterprise.

Notices


Reply
  Search this Thread
Old 10-11-2016, 03:16 PM   #1
suchitpati
LQ Newbie
 
Registered: Oct 2016
Posts: 2

Rep: Reputation: Disabled
Unhappy sgid bit is not inherited by few directories


OS : RHEL 7.2 64 bit
I have set the SGID bit on the parent directory using the command :

chmod 2775 <directory name>

Then I installed a tomcat based application on that directory (Just by unzipping the software zip file.. no other step).

However, some folder created during the unzipping process (and some directories may have been created afterwards by the application) did not inherit the SGID bit. (So, all the files under such directories were created with the default group, which is not correct).

But, Most of the directory got the Sgid bit from the parent directory, but few did not.

Has anyone faced this problem before? Any idea, what could have caused it?

Last edited by suchitpati; 10-11-2016 at 03:30 PM. Reason: Add the chmod command.
 
Old 10-14-2016, 02:14 PM   #2
MadeInGermany
Senior Member
 
Registered: Dec 2011
Location: Simplicity
Posts: 2,816

Rep: Reputation: 1211Reputation: 1211Reputation: 1211Reputation: 1211Reputation: 1211Reputation: 1211Reputation: 1211Reputation: 1211Reputation: 1211
Yes that happens when a directory is created with explicit permissions.
Like
Code:
mkdir -m 755 newdir
The explicit permissions override the inherited permissions.
When extracting a zip|tar|cpio archive, it tries to also restore the permissions from the archive - again overriding the inherited permissions.
 
1 members found this post helpful.
Old 10-14-2016, 02:35 PM   #3
suchitpati
LQ Newbie
 
Registered: Oct 2016
Posts: 2

Original Poster
Rep: Reputation: Disabled
Thanks a lot for your reply. I will check with our app team.

By the way, is there an option to use in order to prevent zip/tar/cpio from restoring permission from archive?

Last edited by suchitpati; 10-14-2016 at 02:46 PM. Reason: update
 
Old 10-15-2016, 09:49 AM   #4
MadeInGermany
Senior Member
 
Registered: Dec 2011
Location: Simplicity
Posts: 2,816

Rep: Reputation: 1211Reputation: 1211Reputation: 1211Reputation: 1211Reputation: 1211Reputation: 1211Reputation: 1211Reputation: 1211Reputation: 1211
I think there is no such option.
You can study the man pages e.g.
Code:
man unzip
You better run a
Code:
find . -type d -exec chmod 2775 {} +
after an extraction.
 
1 members found this post helpful.
  


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
[SOLVED] suid & sgid on directories Soji Antony Linux - Newbie 3 05-30-2011 01:24 AM
what are suid , sgid and sticky bit ? kishor2489 Linux - Newbie 1 01-28-2010 10:28 PM
remove suid, sgid bit fw12 Linux - Security 3 01-22-2010 12:58 AM
sgid and sticky bit levis_inferno Linux - Networking 5 06-01-2006 01:00 AM
SGID and SUID on Directories mikeyt_333 Linux - General 1 03-26-2002 02:41 PM

LinuxQuestions.org > Forums > Enterprise Linux Forums > Linux - Enterprise

All times are GMT -5. The time now is 07:03 AM.

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