#include #include #include #include int main(int argc, char *argv[]) { int fd; if (argc < 2) { printf ("usage : ./test_capuse userid1@userid2@randomstring & \n"); exit(-1); } fd = open("/dev/capuse", O_RDWR); if (fd < 0) perror("error opening the file"); int status; status = write(fd, argv[1], strlen(argv[1])); if (status < 0) { perror("error writing to the file"); exit(-1); } printf("Capability successfully written to the /dev/capuse \n"); printf ("The user id of the process is now changed to the target user specified. Please do a 'ps -eaf | grep capuse' and verify. \n"); while (1) sleep(1); return 0; }