[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: opinion on shell cgi scripts



* Ben Goren <ben@trumpetpower.com> [01.11.2004 15:07]:
> >> You can't make scripts suid, only binaries.
> >
> > Really ?
> 
> Really.
> 
> $ id && cat suid-whoami && ls -l suid-whoami && ./suid-whoami
> uid=501(ben) gid=501(ben) groups=501(ben), 0(wheel), 5(operator), 
> 9(wsrc), 20(staff), 67(www), 20002(artsed)
> #!/bin/sh
> 
> id
> -rwsr-sr-x  1 nobody  nobody  14 Nov  1 06:55 suid-whoami*
> uid=501(ben) gid=501(ben) groups=501(ben), 0(wheel), 5(operator), 
> 9(wsrc), 20(staff), 67(www), 20002(artsed)

You shouldn't try this on a nosuid-mounted partition.

$ id
uid=4179(armin) gid=0(wheel) groups=0(wheel), 9(wsrc)
$ ls -l suid-whoami
-rwsr-sr-x  1 nobody  nobody  16 Nov  1 15:12 suid-whoami
$ cat suid-whoami
#!/bin/sh
id
$ ./suid-whoami
uid=4179(armin) euid=32767(nobody) gid=0(wheel) egid=32767(nobody) groups=0(wheel), 9(wsrc)

Regards,
Armin Wolfermann