Messages in this thread | | | Date | Sun, 8 Feb 1998 23:38:18 +0300 (MSK) | From | "Pawel S. Veselov" <> | Subject | access() system call |
| |
Hello, All !
I found strange behavior for access() system call :
compiling and executing this program
------------------ #include <stdio.h> #include <unistd.h>
void main(void) { setreuid(1224,0); printf("reuid=%d,euid=%d\n",getuid(),geteuid()); if ((access("/vmlinuz",R_OK | W_OK))<0) perror("access"); if ((chmod("/dev/ttyS0",0600))<0) perror("chmod"); setreuid(0,1224); printf("reuid=%d,euid=%d\n",getuid(),geteuid()); if ((access("/vmlinuz",R_OK | W_OK))<0) perror("access"); if ((chmod("/dev/ttyS0",0600))<0) perror("chmod");
} ------------------
gives following results :
------------------
[root@unicorn]/home/vps/c# ./tuid reuid=1224,euid=0 access: Permission denied reuid=0,euid=1224 chmod: Operation not permitted [root@unicorn]/home/vps/c# ls -la /vmlinuz -rw-r--r-- 1 root root 374386 Jan 24 01:29 /vmlinuz [root@unicorn]/home/vps/c# ls -ls /dev/ttyS1 0 crw------- 1 uucp uucp 4, 65 Feb 8 22:37 /dev/ttyS1 [root@unicorn]/home/vps/c#
------------------
How can I read/write /vmlinuz but can't chmod() (I am not root) and why can I chmod() but can't access r/w /vmlinux ( I am real root at this )
Any suggestions ?
Bye. -- You know you have a small apartment when Rice Krispies echo. -- S. Rickly Christian
-- With best of best regards, Pawel S. Veselov (aka Black Angel) internet : vps@unicorn.niimm.spb.su ( mail,finger,talk ) Web page : http://www.niimm.spb.su/~vps/ ICQ : 5252265
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu
| |