LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 11-24-2013, 07:38 AM   #1
Energyfellow
LQ Newbie
 
Registered: Nov 2013
Location: Ghent, Belgium
Distribution: Ubuntu, Pear OS, Windows 8 & 8.1
Posts: 2

Rep: Reputation: Disabled
SGID


Hello,

I'm struggling with the SGID command.

Given the following situation:

----rws--- 1 simon simon 233 nov 24 13:52 hosts

Why can't a user open/edit this file?

Thanks in advance,
Simon

Last edited by Energyfellow; 11-24-2013 at 07:40 AM.
 
Old 11-25-2013, 05:35 AM   #2
bknapek
LQ Newbie
 
Registered: Dec 2009
Distribution: Slackware
Posts: 18

Rep: Reputation: 1
You mean why user simon can't access the file?
That is because you took away all user permissions for the poor guy.

If you changed the file to be owned by anybody else, but still the simon group, e.g.:

----rw---- 1 nobody simon 233 nov 25 12:29 hosts

then simon will be able to r/w the file.

The s-bit is intended for files that you execute, or directories.
It does not directly influence access permissions.
 
Old 11-25-2013, 07:12 AM   #3
Energyfellow
LQ Newbie
 
Registered: Nov 2013
Location: Ghent, Belgium
Distribution: Ubuntu, Pear OS, Windows 8 & 8.1
Posts: 2

Original Poster
Rep: Reputation: Disabled
Bknapek,

Thanks for the reply.
I intentionnaly thought that, SGID meant that, whenever someone tried to open the file, he/she automatically got the grouppermissions.
However, I now realize that SGID means that, for exemple: every file made in a directory automatically belongs to the specified group if there's a (recursive) SGID on the directory.

Thank you for your answer,
Simon
 
Old 11-25-2013, 01:59 PM   #4
bknapek
LQ Newbie
 
Registered: Dec 2009
Distribution: Slackware
Posts: 18

Rep: Reputation: 1
If you want user simon to be able to access certain files, then you could use ACLs.

The following command:

setfacl -m u:simon:rw hosts

will create an exemption to the standard access rights and will allow user simon to rw the file.

You can check with:

getfacl hosts
# file: hosts
# owner: root
# group: root
user::rw-
user:simon:rw-
group::r--
mask::rw-
other::r--

You can apply ACL also to directories - use with care :-)

cheers!
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
SUID vs SGID mmhs Linux - Newbie 3 09-15-2013 04:08 PM
suid & sgid Soji Antony Linux - Newbie 3 05-31-2011 11:13 AM
SGID and SUID Paris Heng Linux - General 2 11-08-2008 09:45 PM
which suid sgid to unset? hank43 Linux - Security 1 10-09-2006 01:46 AM
sgid and sticky bit levis_inferno Linux - Networking 5 06-01-2006 01:00 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

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