Re: How Do I Run a Java App with Superuser Privileges?
site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com Change bar.sh to be : #!/bin/bash -p id ps -utp1 - Allan On Dec 14, 2004, at 1:08 AM, Justin Walker wrote: On Dec 13, 2004, at 21:45, James Berry wrote: Well, well, well, .... Thanks for digging in further... Regards, Justin _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/ajn%40apple.com _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... ... and note the "-p" bash argument which is described in the last paragraph of the "INVOCATION" section of the man page. On Dec 13, 2004, at 9:24 PM, Justin Walker wrote: On Dec 13, 2004, at 21:11, James Berry wrote: [snip] Most systems will not permit shell scripts to execute 'setuid'. Works for me... (TM). (Note the euid...) It'll take me a while to figure this one out. Seems that bash and sh have somewhat different behaviors: $ cat foo.sh #!/bin/sh id ps -utp1 $ cat bar.sh #!/bin/bash id ps -utp1 $ls -l *.sh -r-sr-xr-x 1 root staff 24 13 Dec 22:01 bar.sh -r-sr-xr-x 1 root staff 22 13 Dec 22:00 foo.sh $ foo.sh uid=10180(justin) euid=0(root) gid=20(staff) groups=20(staff), 79(appserverusr), 80(admin), 81(appserveradm) USER PID %CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND justin 281 0.2 0.2 18644 1392 std S 4Dec04 0:01.57 -bash root 279 0.0 0.3 27540 2000 std Ss 4Dec04 0:00.04 login -pf ju root 4373 0.0 0.1 18644 564 std S+ 10:00PM 0:00.03 sh ./foo.sh root 4375 0.0 0.1 18076 684 std R+ 10:00PM 0:00.02 ps -utp1 $ bar.sh uid=10180(justin) gid=20(staff) groups=20(staff), 79(appserverusr), 80(admin), 81(appserveradm) USER PID %CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND justin 4378 3.0 0.1 18644 1012 std S+ 10:01PM 0:00.01 bash ./bar.s root 279 0.0 0.3 27540 2000 std Ss 4Dec04 0:00.04 login -pf ju justin 281 0.0 0.2 18644 1392 std S 4Dec04 0:01.57 -bash root 4380 0.0 0.0 18076 308 std R+ 10:01PM 0:00.01 ps -utp1 Looks to me like there is either a compatibility issue at play, or a bug in the system somewhere... 'tcsh' and 'bash' behave the same: scripts can't execute as setuid root. For 'sh', it appears they can...weird. -- Justin C. Walker, Curmudgeon-At-Large * Institute for General Semantics | "Weaseling out of things is what | separates us from the animals. | Well, except the weasel." | - Homer J Simpson *-------------------------------------- *-------------------------------* This email sent to ajn@apple.com This email sent to site_archiver@lists.apple.com
participants (1)
-
Allan Nathanson