Solved

Start process with specific id at bootime -Solaris 2.6

Posted on 2000-05-06
3
294 Views
Last Modified: 2013-12-27
On solaris 2.6 (sparc)I have Apache firing up from the /etc/rc3.d directory.

I need to start a process for some webtools at bootime as well, with a specific userid?
eg sysadmin

The syntax to start manually is....
/usr/local/apache/virtualhosts/webtools/bin/apachetcl start
This script is owned by root

How can this be done...thanks in advance
0
Comment
Question by:hyphen
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 2

Accepted Solution

by:
festive earned 200 total points
ID: 2783894
sounds like what you need is a SETUID
script, if I follow what you are saying correctly, then this is what you need..

Key things to remember : when you name the script /etc/rc3.d/S90webutils (etc)
you must start it AFTER apache, so pick a higher number than apaches (ie the 90 should be high enough)
Benefits of using the "su" method are that the process will inherit the login environment of the sysadmin user - this could be usefull if you have environment variables which others are changing and you don't want to keep updating the script.

Hope this helps

#!/bin/sh -p
# setuid shell script to start Apache and Web Tools
# install into /etc/rc3.d
# make owner "sysadmin"
# make group "bin"
# run chmod 4750 on the file (setuid)
# This will start the programs as "sysadmin"
echo "`date`: web started" >> /usr/local/logs/webstart.log
# now start apache as "sysadmin"
/usr/local/apache/virtualhosts/webtools/bin/apachetcl start
# optionally you could run the script as root
# and start with an su command like:
# su - sysadmin -c "/usr/local/apache/virtualhosts/webtools/bin/apachetcl start"


0
 
LVL 2

Expert Comment

by:festive
ID: 2783895
the "su" method requires no setuid but does mean that root could be running things that could be altered by others (in this case the .profile of sysadmin)
0
 

Author Comment

by:hyphen
ID: 2803340
Thanks Festive,
Tried su - c "/usr/local/....blah, blah" in a symlink...it bombed out with an apache exit code 3

SETUID script is an effective way to run as "a specific user".

However, have found out there is a "virtualhosts/webtools/conf/http.conf" file with in Apache that you can use to set the user/group that this runs under. Then place appropriate symlink in the rc3.d directory (it kicks off as root and changes to "specified user/group"
regards hyphen
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have been running these systems for a few years now and I am just very happy with them.   I just wanted to share the manual that I have created for upgrades and other things.  Oooh yes! FreeBSD makes me happy (as a server), no maintenance and I al…
Every server (virtual or physical) needs a console: and the console can be provided through hardware directly connected, software for remote connections, local connections, through a KVM, etc. This document explains the different types of consol…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question