6

suid-root doesn't have effect

view full story
linux-howto

http://unix.stackexchange.com – A program from apue. #include "apue.h" #include <fcntl.h> int main(int argc, char *argv[]) { if(argc!=2) err_quit("usage: a.out <pathname>"); if(access(argv[1], R_OK)<0) err_ret("access error for %s",argv[1]); else printf("read access OK\n"); if (open(argv[1], O_RDONLY)) { err_ret("open error for %s", argv[1]); } else { printf("open for reading OK\n"); } return 0; } I compiled it to an executable named 4-2 and I changed the owner and set the suid this is the output of ls -l: -rwsr-xr-x 1 root sinners 8490 (HowTos)