Running Glassfish on Port 80 as Non-root Solaris 10 User

By default, you cannot use ports below 1024 if you are running Glassfish or Sun Java System Application Server (or anything else, for that matter) as non-root Solaris user. Solaris 10 provides role
based access control (RBAC) which makes this rather trivial (although
you'll still need one-time root user access to make it possible).

So, how to do it?

Step 1: login as root user or run su command

Step 2: run following command:

  /usr/sbin/usermod -K defaultpriv=basic,net_privaddr <username>

where <username> is the username you are using to run Glassfish.


That's it :-)

Comments:

Thanks for the tip. I added the new privileges to the "webservd" user via usermod and found that I could not bind to port 80 via SMF. I ended up needing to specify the new privileges in my manifest. Perhaps, those savvy with SMF know this already, but alas I am new to it. The good news, it didn't take me that long to figure it out. Here is my working start method for app server.

<exec_method type='method'
             name='start'
             exec='/app/appserv/bin/asadmin start-domain domain1'
             timeout_seconds='60'>
    <method_context>
        <method_credential user='webservd'
                 group='webservd'
                 privileges='basic,net_privaddr'/>
    </method_context>
</exec_method>

Posted by Matthew Montgomery on June 26, 2006 at 07:07 AM PDT #

Thank you for your comment! Using net_privaddr privilege in the context of SMF integration was (somewhat) covered in Kedar Mhaswade's blog entry. In any case I am glad you figured it out :-)

Posted by Snjezana on June 27, 2006 at 07:53 AM PDT #

Is there a way to accomplish the same thing on Mac OS X?

Posted by Bob Haupt on July 08, 2006 at 05:12 AM PDT #

Reply to Bob Haupt: I am definitely not Mac OS X expert, but Google returned these:
http://developer.apple.com/macosx/launchd.html
Quote: "Of particular interest is that launchd can run a job as a non-root user, but still bind it to a privileged port. This removes one common reason to run daemons as root."
Also:
http://forum.textdrive.com/viewtopic.php?pid=43297
You might want to check it out and see if this can fit your purpose, but as far as I can tell it is not really the equivalent of Solaris RBAC.

Posted by Snjezana on July 10, 2006 at 04:33 AM PDT #

Post a Comment:
  • HTML Syntax: NOT allowed
About

snjezana

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today