Getting the UID

    pwd = getpwnam("bozo");
    assert(pwd != NULL);
    output_uid = pwd->pw_uid;
    output_gid = pwd->pw_gid;
    cout << "writing files as " << WRITTEN_FILES_OWNER << " (uid: " << output_uid << ")" << endl;

Changing the group

(note, since only root can change owndership, we indicate we won't try to change ownership with -1.)
result = chown(filename, -1, output_gid);

-- MattWalsh - 12 Feb 2006

Topic revision: r1 - 12 Feb 2006 - MattWalsh
 
This site is powered by the TWiki collaboration platformCopyright © 2008-2012 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback