Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This question already has an answer here:

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 ?

share|improve this question

marked as duplicate by terdon, slm, vonbrand, jasonwryan, Anthon Mar 12 '14 at 3:43

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

up vote 1 down vote accepted

You (as a regular user) can't "give away" your files. Root, whoever, can do it.

share|improve this answer
The ability for a non-root user to "give away" files can actually be configured per filesystem, at least on some OSs. But giving non-root users that ability can open security holes, so it's usually disabled. – Keith Thompson Mar 12 '14 at 0:36
@KeithThompson, never seen such on any Unixy system. Care to expand? – vonbrand Mar 12 '14 at 0:42
I've seen it on a UNIX system some years ago; I don't remember the exact details off the top of my head, but I think it was an Alpha OSF1 system. See man pathconf; calling it with _PC_CHOWN_RESTRICTED tells you whether chown is restricted to root for the given path. (I don't think Linux lets you remove that restriction.) – Keith Thompson Mar 12 '14 at 0:52
@KeithThompson, as I remembered. The chown(2) system call may only be invoked by a privileged process (in Linux' case, one which has CAP_CHOWN, in general only root). AFAIU from pathconf(3) and chown(2), it is possible to restrict that rootly power for some files, not to relax it. – vonbrand Mar 12 '14 at 1:14
POSIX: "[EPERM] The effective user ID does not match the owner of the file, or the calling process does not have appropriate privileges and POSIX_CHOWN_RESTRICTED indicates that such privilege is required." – Keith Thompson Mar 12 '14 at 1:17

Not the answer you're looking for? Browse other questions tagged or ask your own question.