0

We have a NFS server provide home directory for many account, which provided by a NIS server.

I have account A and B. In /home/A, I try to copy "cp -a /home/B/somedir ~/". Then I found in /home/A/somedir, all files are owned by user A.

Then if I do "chown -R B:B somedir", I got "Operation not permitted" error.

I am user A, "cp -a" didn't preserve the original user (B). Then I cannot chown my own files.

Any suggestion?

I fix my own issue by "chmod 777 /home/A", "su - B" and "cp -a somedir /home/A/", and "su - A", then "chmod 755 /home/A". But it is not a good solution.

  • As the answer below says, there is no good solution. Perhaps there is a wider problem that lead you to keeping files owned by one user in the directory of another user. Maybe this problem has an entirely different solution that avoids the need to mix ownership. Could you explain, what you are trying to do in a wider context? – Dmitri Chubarov Oct 6 '12 at 15:51
3

What you describe is perfectly normal behaviour of a regular UNIX system.

A regular user can't and should not chown files to other users. Only root may do that.

The Open Group's documentation and Wikipedia claim that there are implementations which allow regular users to 'give away' ownership, but they do not state which systems that would be. I can tell for Linux and Solaris, that chown for regular users doesn't work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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