Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Run a process at startup as another user than root

Posted on 2004-10-14
5
Medium Priority
?
1,537 Views
Last Modified: 2013-12-27
We have an application that the client would like to kick off as another user than root. The script to start the processes is in /etc/rc2.d. Is there a way to do this?
0
Comment
Question by:ferg-o
  • 2
  • 2
5 Comments
 
LVL 40

Accepted Solution

by:
jlevie earned 1000 total points
ID: 12315119
Sure, something like:

su -c - some-user "/path-to/some-executable"

in the rc2.d init script.
0
 
LVL 38

Assisted Solution

by:yuzh
yuzh earned 1000 total points
ID: 12315121
In your startup startup script, you do:

su - fred -c "/path-to/app"

this will run app as user fred.

man su
to learn more details
0
 
LVL 38

Expert Comment

by:yuzh
ID: 12315140
jlevie, you must be half second or less faster than me, same time stamp !
0
 
LVL 40

Expert Comment

by:jlevie
ID: 12315149
Yeah, that doesn't happen all that often.
0
 
LVL 4

Author Comment

by:ferg-o
ID: 12315484
So close I had to split the points! Thanks...
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

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…
Why Shell Scripting? Shell scripting is a powerful method of accessing UNIX systems and it is very flexible. Shell scripts are required when we want to execute a sequence of commands in Unix flavored operating systems. “Shell” is the command line i…
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.
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.
Suggested Courses
Course of the Month11 days, 11 hours left to enroll

916 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