Re: How Do I Run a Java App with Superuser Privileges?
Re: How Do I Run a Java App with Superuser Privileges?
- Subject: Re: How Do I Run a Java App with Superuser Privileges?
- From: James Berry <email@hidden>
- Date: Mon, 13 Dec 2004 21:45:44 -0800
On Dec 13, 2004, at 9:24 PM, Justin Walker wrote:
On Dec 13, 2004, at 21:11, James Berry wrote:
Java won't do this for you automatically. Ultimately you've got to
get it running at superuser privilege. Common techniques include
using a script to run it with su privileges by setting the ownership
to root, and setting the suid bit.
FWIW, I don't think this will work on most recent unices. It
definitely doesn't on Mac OS X, 10.3.6:
$ cat foo.sh
id
$ ls -l foo.sh
-r-sr-xr-x 1 root staff 3 13 Dec 21:22 foo.sh
$ foo.sh
uid=10180(justin) gid=20(staff) groups=20(staff), 79(appserverusr),
80(admin), 81(appserveradm)
Most systems will not permit shell scripts to execute 'setuid'.
Works for me... (TM). (Note the euid...)
caddy:jberry ~/bin % cat > test
#!/bin/sh
id
caddy:jberry ~/bin % sudo chown root test
caddy:jberry ~/bin % sudo chmod +xs test
caddy:jberry ~/bin % ls -l test
-rwsr-sr-x 1 root jberry 14 13 Dec 21:41 test
caddy:jberry ~/bin % ./test
uid=501(jberry) euid=0(root) gid=501(jberry) groups=501(jberry),
79(appserverusr), 80(admin), 81(appserveradm), 505(svn)
caddy:jberry ~/bin % uname -v
Darwin Kernel Version 7.6.0: Sun Oct 10 12:05:27 PDT 2004;
root:xnu/xnu-517.9.4.obj~1/RELEASE_PPC
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden