Solved

Start process with specific id at bootime -Solaris 2.6

Posted on 2000-05-06
3
291 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
  • 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

When you do backups in the Solaris Operating System, the file system must be inactive. Otherwise, the output may be inconsistent. A file system is inactive when it's unmounted or it's write-locked by the operating system. Although the fssnap utility…
Let's say you need to move the data of a file system from one partition to another. This generally involves dismounting the file system, backing it up to tapes, and restoring it to a new partition. You may also copy the file system from one place to…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
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.:

813 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now