I have a directory that has the SGID bit set,
ls displays it as
drwxr-sr-x, and is owned by a normal user.
I have a file that is owned by root in that directory, with permission 644.
The question is can I make that file become owned by the user-owner of the directory.
- I don’t know of any general, magical way
of changing the ownership of an existing file.
If you want to change the owner of the file,
you’ll have to
chownit (as root, i.e.,
- The SGID bit a directory has nothing to do with the (user) ownership of files in that directory. It causes all subsequently (i.e., future) created files in that directory to have the same group ownership as the directory itself.