0

This question already has an answer here:

How would I change the ownership of a recently made file to root user ownership from its original owner? Every time I type in the following (below), I get a message saying that it can't change the ownership.

For Example:

touch myfile
chown root myfile

marked as duplicate by Zanna, Pilot6, Andrea Lazzarotto, David Foerster, karel Dec 4 '16 at 12:31

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.

  • Is the file on an NTFS partition? – wjandrea Dec 3 '16 at 1:29
  • You need sudo before chmod – Sergiy Kolodyazhnyy Dec 3 '16 at 1:45
  • Are you trying to change the ownership of the file as a "normal", unprivileged user? Only the privileged root user is allowed to change file ownerships. To execute a command with privileged permissions, you can use sudo ("switch user and do" - in this case, "switch to root and do"). – Henning Kockerbeck Dec 3 '16 at 1:47
3

Unprivileged user can't change ownership of a file. To do so, you must be a privileged user or use sudo before chown command. Consider that you must be sudoer to issue sudo.

touch myfile
sudo chown root myfile

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