I am on slackware64 v14.0 and I have file that belongs to me:
-rwxrwxr-x+ 1 nass shares 137934 Mar 7 00:06 myfile.csv*
I am a member of the "shares" group.
The folder that contains myfile
looks like this
drwxrwsr-x+ 12 nass shares 4096 Mar 12 04:54 winmx/
I now want to give ownership of this file to another user of this pc. The other user is also a member of the shares group. However,
chown otheruser myfile.csv
does not do the trick. I get a
chown: changing ownership of 'myfile.csv': Operation not permitted
I had recently asked a similar question about gid
, but this is not the same problem.
How can I solve this ?
man pathconf
; calling it with_PC_CHOWN_RESTRICTED
tells you whetherchown
is restricted to root for the given path. (I don't think Linux lets you remove that restriction.) – Keith Thompson Mar 12 '14 at 00:52chown(2)
system call may only be invoked by a privileged process (in Linux' case, one which hasCAP_CHOWN
, in general only root). AFAIU frompathconf(3)
andchown(2)
, it is possible to restrict that rootly power for some files, not to relax it. – vonbrand Mar 12 '14 at 01:14EPERM
] The effective user ID does not match the owner of the file, or the calling process does not have appropriate privileges andPOSIX_CHOWN_RESTRICTED
indicates that such privilege is required." – Keith Thompson Mar 12 '14 at 01:17