LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-19-2007, 01:49 PM   #1
st00
Member
 
Registered: Apr 2003
Posts: 50

Rep: Reputation: 15
Run program as another user


Hi I have an Apache webserver set up on a Fedora Core 1 machine and have been using gnump3d to serve mp3s over my network.

The problem is that if there's a power cut or something and the machine shuts down, I have to manually log on and start gnump3d again. I decided to fix it yesterday after another power cut and tried adding

/usr/bin/gnump3d

to /etc/rc.local (I think)

It worked and gnump3d was started but the problem is that it was started by user 'nobody' (checked using ps aux).

I need to have gnump3d started by user 'stu' for example so is there a way to do this perhaps using 'su' although I don't want a shell opening.

Thanks, Stu
 
Old 03-19-2007, 02:03 PM   #2
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556
su -c /usr/bin/gnump3d stu

Try this

...as deduced from info in this page:
http://www.ss64.com/bash/su.html
and check here too:
http://www.linuxquestions.org/questi...d.php?t=377254

Last edited by GrapefruiTgirl; 03-19-2007 at 02:07 PM.
 
Old 03-19-2007, 02:36 PM   #3
st00
Member
 
Registered: Apr 2003
Posts: 50

Original Poster
Rep: Reputation: 15
Thanks for the super-fast response. I did have a look through the manual entry for su but it sounded to me like the -c option opened the shell and then sent a command to it. The explanation at http://www.ss64.com/bash/su.html seems much clearer, I think this is exactly what I need.

I'll give it a try when I get in tonight - and let you know.

 
Old 03-19-2007, 04:00 PM   #4
st00
Member
 
Registered: Apr 2003
Posts: 50

Original Poster
Rep: Reputation: 15
The su command didn't work properly, well it worked but it started another process (su) as well as the gnump3d process. I checked the sudo command and the following seems to have worked ...

sudo -u stu -b /usr/bin/gnump3d

Thanks for the help GrapefruiTgirl.

Take it easy, Stu
 
Old 03-19-2007, 06:10 PM   #5
GrapefruiTgirl
LQ Guru
 
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556Reputation: 556
Hey cool, glad you figured that out; I learned something as well
Take care.
SV
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
run program as different user h2gofast Linux - Newbie 2 11-26-2005 12:05 PM
Need to have program run as different user exodist Linux - Software 5 10-26-2005 10:07 PM
Run program as user falcon Linux - Newbie 1 11-07-2004 11:17 AM
How Do I Run A Program As A Different User?? Wolf-67 Linux - Newbie 3 10-04-2004 12:26 PM
How to run a program as a different user? Guru3 Linux - General 4 11-04-2003 12:35 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:29 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration