Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to set up a web server at home using Ubuntu, but prefer my bash scripts to be platform agnostic hence why I am asking here. I also dislike apt-get everything. I am trying to create a single bash script to quickly rebuild my server or possibly use with VM's

It is my understanding that any services with open ports can pose security risks if run as 'root' to avoid this I have created a serviceadmin group and for each service I create a user similar to:

useradd lamppadmin -g servicepadmin -s /sbin/nologin
    useradd tomcatadmin -g servicepadmin -s /sbin/nologin

I then install the needed services and restrict their permissions and files accordingly. Given that I am most likely to add more services to this group, I would like to know how one launches multiple service to "run as" group or each individual service as the appropriate user.

I always symbolically link launch commands to /usr/binso that I am able to run them from anywhere. So I am just looking for an example to target lampp start as an example where it needs to interact with files that belong to user lamppadmin or serviceadmin group

share|improve this question
Since this depends on the init system used, it will never be platform agnostic without a bunch of if [[ $os == blah ]] like statements. – jordanm Nov 1 '12 at 23:24

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.