mv, cp, and sgid on directories (was: cp -p)

2008-02-09 Thread Jonathan McKeown
I think you may be getting too deep into the detail. Think of the bigger picture: when I move a file, I don't expect that to change its ownership or permissions - it would surprise me if it did; when I make a copy of a file, I expect to own the copy - after all, what use is a private copy I

Re: mv, cp, and sgid on directories (was: cp -p)

2008-02-09 Thread Matthew Seaman
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 Jonathan McKeown wrote: The bit that still worries me in this discussion is the sgid bit (pun not intended, but I'm not going to delete it now!): as I understand it, creating a file has different behaviour on SYSV-derived systems and

Re: cp -p

2008-02-08 Thread Jonathan McKeown
doesn't know anything about gid 80. Now, on HostClient, user copies aFile to /share/www using the -p flag of cp(1). cp -p aFile /share/www/ ls -l -rw--- 1 user user 2981888 Feb 7 01:09 /www/aFile As shown, the setgid flag of /www hasn't worked. Hang on - you asked cp to preserve

Re: cp -p

2008-02-08 Thread Pietro Cerutti
on /share/www. HostClient doesn't know anything about gid 80. Now, on HostClient, user copies aFile to /share/www using the -p flag of cp(1). cp -p aFile /share/www/ ls -l -rw--- 1 user user 2981888 Feb 7 01:09 /www/aFile As shown, the setgid flag of /www hasn't worked. Hang on - you

rename and chmod (was: cp -p)

2008-02-08 Thread Pietro Cerutti
Ok, my view is getting clearer ;-) my problem in understanding the semantics of mv, cp -p and the rename(2) function seems to be related to the terminology used in chmod(1) man page. This is the explanation of setuid (the same holds for setgid): Directories with this bit set will force all

rename and chmod (was: cp -p)

2008-02-08 Thread Wouter Oosterveld
Now, from a logical point of view, why moving a file into a directory doesn't fall into the created into them case? Because (if on the same filesystem) you don't create a new file. You just link the file in the destination dir and unlink the file from the source dir. Exactly. But

Re: rename and chmod (was: cp -p)

2008-02-08 Thread Wouter Oosterveld
, Pietro Cerutti [EMAIL PROTECTED]: Ok, my view is getting clearer ;-) my problem in understanding the semantics of mv, cp -p and the rename(2) function seems to be related to the terminology used in chmod(1) man page. This is the explanation of setuid (the same holds for setgid): Directories

Re: rename and chmod (was: cp -p)

2008-02-08 Thread Pietro Cerutti
Wouter Oosterveld wrote: Now, from a logical point of view, why moving a file into a directory doesn't fall into the created into them case? Because (if on the same filesystem) you don't create a new file. You just link the file in the destination dir and unlink the file from the source

Re: rename and chmod (was: cp -p)

2008-02-08 Thread Jerry McAllister
On Fri, Feb 08, 2008 at 12:30:57PM +0100, Pietro Cerutti wrote: Wouter Oosterveld wrote: Now, from a logical point of view, why moving a file into a directory doesn't fall into the created into them case? Because (if on the same filesystem) you don't create a new file. You just link

Re: cp -p

2008-02-07 Thread Pietro Cerutti
Chuck Swiger wrote: On Feb 7, 2008, at 10:42 AM, Pietro Cerutti wrote: From HostClient: ls -al /share/ drwxr-sr-x 4 User www 512 Feb 7 19:23 www touch /share/www/foo ls -l /share/www/foo -rw-r- 1 user www 0 Feb 7 19:39 /share/www/foo (group id works) Right, this

Re: cp -p

2008-02-07 Thread Pietro Cerutti
Pietro Cerutti wrote: Chuck Swiger wrote: On Feb 7, 2008, at 10:07 AM, Pietro Cerutti wrote: here's the situation: HostServer exports via NFS /www, which belongs to user:www (uid=1001, gid=80). The directory has the segid flag set: drwsr-xr-x 13 user www 512 Feb 7 00:58 www Umm, that

Re: cp -p

2008-02-07 Thread Pietro Cerutti
Chuck Swiger wrote: On Feb 7, 2008, at 10:07 AM, Pietro Cerutti wrote: here's the situation: HostServer exports via NFS /www, which belongs to user:www (uid=1001, gid=80). The directory has the segid flag set: drwsr-xr-x 13 user www 512 Feb 7 00:58 www Umm, that directory you show has

Re: cp -p

2008-02-07 Thread Chuck Swiger
On Feb 7, 2008, at 10:07 AM, Pietro Cerutti wrote: here's the situation: HostServer exports via NFS /www, which belongs to user:www (uid=1001, gid=80). The directory has the segid flag set: drwsr-xr-x 13 user www 512 Feb 7 00:58 www Umm, that directory you show has the setuid bit set, not

cp -p

2008-02-07 Thread Pietro Cerutti
. Now, on HostClient, user copies aFile to /share/www using the -p flag of cp(1). cp -p aFile /share/www/ ls -l -rw--- 1 user user 2981888 Feb 7 01:09 /www/aFile As shown, the setgid flag of /www hasn't worked. Now in man cp, I can read the following: If the source file has its set-user

Re: cp -p

2008-02-07 Thread Chuck Swiger
On Feb 7, 2008, at 10:42 AM, Pietro Cerutti wrote: From HostClient: ls -al /share/ drwxr-sr-x 4 User www 512 Feb 7 19:23 www touch /share/www/foo ls -l /share/www/foo -rw-r- 1 user www 0 Feb 7 19:39 /share/www/foo (group id works) Right, this is the BSD setgid

FreeBSD 5.4: 'cp -p' does not behave as documented

2006-08-28 Thread Gabriel O'Brien
Hi folks, FreeBSD 5.4-RELEASE-p6 i386 We have a script in our environment that is used to back up our mail logs. In essence it does: cp -p /var/log/maillog.0.bz2 /stats/maillogs/maillog-testcopy.bz2 According to the cp man page: snip -p Cause cp to preserve the following attributes

Re: FreeBSD 5.4: 'cp -p' does not behave as documented

2006-08-28 Thread Derek Ragona
You need to run this as root so the permissions and ownership all can be set. -Derek On Mon, 28 Aug 2006, Gabriel O'Brien wrote: Hi folks, FreeBSD 5.4-RELEASE-p6 i386 We have a script in our environment that is used to back up our mail logs. In essence it does: cp -p /var/log

Re: FreeBSD 5.4: 'cp -p' does not behave as documented

2006-08-28 Thread David King
is displayed and the exit value is not altered. However, when I run this script or when I do a cp -p manually I am seeing: cp: chown: /stats/maillogs/maillog-copy-test.bz2: Permission denied You need to run this as root so the permissions and ownership all can be set. -Derek I