Change the current user/group
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <errno.h> #include <unistd.h> #include <sys/stat.h> int main(int argc, char **argv) { char buf[100] = "/home/user/example.txt"; if (chown (buf,100,100) < 0) { exit(1); } return(0); } |