Bug 113397 - sgid directory changes permission when files are copied, created but not moved
sgid directory changes permission when files are copied, created but not moved
Product: Red Hat Enterprise Linux 3
Classification: Red Hat
Component: kernel (Show other bugs)
i686 Linux
medium Severity medium
: ---
: ---
Assigned To: Stephen Tweedie
Brian Brock
Depends On:
  Show dependency treegraph
Reported: 2004-01-13 10:40 EST by Xander D Harkness
Modified: 2016-06-07 18:44 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2004-01-15 06:31:07 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Xander D Harkness 2004-01-13 10:40:51 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030922

Description of problem:
I have a directory /home/luke/blaster with permissions: rwxr-sr-x

owned by luke group is blaster

cp hello blaster
touch blaster/hello

creates a file with permissions rw-rw-r-- and owner luke group blaster

mv hello blaster

creates a file with permissions rw-rw-r-- owner and group luke

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1.mkdir /home/luke/blaster
2.groupadd blaster
3.chgrp blaster /home/luke/blaster
4.chmod g+s /home/luke/blaster
5.cp hello blaster (works)
6.mv hello blaster (group owner still luke

Actual Results:  Copy and create work 

Expected Results:  move does not change the file group to blaster

Additional info:
Comment 1 Tim Waugh 2004-01-13 10:54:24 EST
Nothing to do with the 'mv' command, but the 'rename' syscall.
Comment 2 Stephen Tweedie 2004-01-15 06:31:07 EST
"mv" simply renames a file.  It doesn't change the file at all.  This
is correct behaviour.

The sgid bit on a directory only affects the gid assigned to *new*
files created inside that directory.  That's why copy and create both
set the gid.  Moving an existing file is not expected to change the gid.

Note You need to log in before you can comment on or make changes to this bug.