19.4. Changing File Permissions or Ownership
chown('/tmp/myfile.txt','sklar'); // specify user by name chgrp('/home/sklar/schedule.txt','soccer'); // specify group by name chown('/tmp/myfile.txt',5001); // specify user by uid chgrp('/home/sklar/schedule.txt',102); // specify group by gid
The superuser can change the permissions, owner, and group of any file. Other users are restricted. They can change only the permissions and group of files that they own, and can't change the owner at all. Nonsuperusers can also change only the group of a file to a group they belong to.
The functions chmod( ), chgrp( ), and chown( ) don't work on Windows.
19.4.4. See Also
Copyright © 2003 O'Reilly & Associates. All rights reserved.