Super User is a question and answer site for computer enthusiasts and power users. 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

I have a homework question about kernel programming in Linux. The question is:

What Linux-specific privilege is required to preserve ownership of a file when it's copied, and how do you get it?

Through experimentation, I've found that I need to be root or a superuser to get this to work. Is there a more specific way to explain this effect?

share|improve this question
up vote 3 down vote accepted

See the capabilities(7) manual page – you need the CAP_CHOWN capability to change file ownership via chown(). (Root has all capabilities enabled automatically. The manual page explains how to obtain capabilities in other cases.)

There is no separate method/capability to just preserve ownership, as Linux file copies are made by simply reading/writing data to the destination file, then doing the same with metadata. (For comparison, Windows NT has SeBackupPrivilege and SeRestorePrivilege privileges and the BackupRead()/BackupWrite() calls.)

share|improve this answer
Sweet, thank you. I had no idea where to look. – Anthony Arnold Aug 21 '11 at 12:09

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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