Adding daemon/web app to Linux group?
Anyone know how to assign a daemon or web app to a *nix group? For example, let's say I have a web app, deployed/running either in a container like tomcat or as a jar, how can I 开发者_高级运维add it to a group?
Daemons usually run under self-named unprivileged users, so You may use standard adduser USER GROUP
command. For instance, to add user tomcat6
to group www-data
You could use:
adduser tomcat6 www-data
To learn for sure what user id runs your application use something like getUid() from com.sun.security.auth.module.UnixSystem. You should include this user int the desired group.
Most likely it is running under the same userid running the webserver/container (in debian-based systems its usualy www-data).
精彩评论