[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Setting group ID




You can also use the chown function.

From "UNIX for Programmers and Users"  by Graham Glass, P 401:

int chown(char * FileName, int ownerId, int groupId);
int fchown (int fd, int ownerId, int groupId);

Putting a -1 in for ownerId or groupId makes them remain unchanged.

Here is an example from the book:

main()
{
int flag
flag=chown("test.txt", -1, 62);
if (flag == -1) perror ("chown.c");

}


This sets the groupId of the test.txt file to 62.  If the file is already
open and you have a file descriptor for it, then you can use the fchown()
function.    
-
To unsubscribe, send email to majordomo@silug.org with
"unsubscribe silug-discuss" in the body.