Article View: aus.computers.linux
Article #47878Re: Could someone please explain...
From: Peter B. West
Date: Mon, 28 Dec 1998 00:00
Date: Mon, 28 Dec 1998 00:00
51 lines
2474 bytes
2474 bytes
MW wrote: > > Could someone please explain the SUID and SGID bits and how they relate > to directories? > Ive read that if u set the SGID bit on a directory then any files (and > directories) created in that directory will have the group set to the > group of that directory > Is this correct? > What happens when u set the SUID bit on a directory-does this do > anything? > Newbie-please help!! SUID has no effect on directories. SGID behaves as you have said. This works in well with the RedHat preferred method of setting up users in individual groups, and setting the default umask to 002 (instead of 022). If you are setting up a directory hierarchy which you want shared with a given group, set the group of the top dir to that of the sharing group, and set the mode to SGID. All files created under that dir will have the shared group id, and by default, your umask of 002 will allow group writes to those files. The `sticky bit' is the equivalent bit on the `other' permissions. On linux, setting this bit on a directory prevents users from removing files which they do not own, regardless of their write permissions on the directory. See, e.g., the default modes on the /tmp directory. Normally, if I have write permission on a directory, I can delete files in that dir; I have write permission on /tmp, so normally I would be able to delete any files found there. Try this: As root, touch /tmp/junk mkdir /tmp/rubbish chmod a+w /tmp/rubbish touch /tmp/rubbish/bin ls -ld /tmp /tmp/rubbish ls -l /tmp/junk /tmp/rubbish/* As yourself (your non-root everyday user id, which of course, you use most of the time) rm -f /tmp/junk rm -f /tmp/rubbish/bin Yours faithfully, -- __ /__ Peter B. West p.west@uq.net.au / http://www.uq.net.au/~zzpwest / "Lord, to whom shall we go?"
Technical Details
Message-ID:
<36874C8D.FD341B25@uq.net.au>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<36723DB3.9DDF6758@bigpond.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 102983,3fc2a250322bcfb X-Google-Attributes: gid102983,public From: "Peter B. West" <p.west@uq.net.au> Subject: Re: Could someone please explain... Date: 1998/12/28 Message-ID: <36874C8D.FD341B25@uq.net.au> X-Deja-AN: 426389916 Content-Transfer-Encoding: 7bit References: <36723DB3.9DDF6758@bigpond.com> To: MW <mwh@bigpond.com> X-Accept-Language: en, Chinese, zh, Japanese, ja, Korean, ko, Russian, ��� Content-Type: text/plain; charset=us-ascii Organization: Dis Mime-Version: 1.0 Newsgroups: aus.computers.linux