Re: [ubuntu-uk] Running daemon at startup as another user

2010-06-23 Thread Matt Wheeler
On 23 June 2010 21:45, Rob Beard  wrote:
> Hi folks,
>
> I'm trying to setup Shoutcast on a VPS server for a mate of mine as a
> favour.  The VPS server is running Ubuntu 8.04 AMD64.
>
> Now I gather from reading up, it is recommended that the shoutcast
> daemon is run as a user rather than root (presumably for security purposes).
>
> The thing is, I can't figure out how to do it.  At first I thought of
> creating an init script, but presumably it'll run as root?
>
> I also thought about cron, but I guess that would require me to enter a
> start time (so if the server goes down say in the middle of the day then
> it'll have to wait until the start time in the crontab?)

You can specify @reboot instead of the time and date settings in
crontab, which is probably the most straightforward way of doing this

> So I wondered if there was any way of running the shoutcast daemon as
> another user basically from when the machine boots?

Alternatively, you can make /etc/rc.local executable (sudo chmod +x
/etc/rc.local) and then add *before the exit 0 line* « sudo -u
username command » -- the crontab method seems neater to me though.

The only issue you might get with the crontab version is if it runs
before the network is initialised and shoutcast expects an interface
to be there. You shouldn't have this problem with rc.local because it
won't run until after all the other init scripts, but it's probably
worth just trying the crontab method first.


-- 
Matt Wheeler
m...@funkyhat.org

-- 
ubuntu-uk@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-uk
https://wiki.ubuntu.com/UKTeam/


Re: [ubuntu-uk] Running daemon at startup as another user

2010-06-23 Thread Simon Greenwood
On 23 June 2010 22:23, Rob Beard  wrote:

> On 23/06/10 22:09, Simon Greenwood wrote:
> >
> >
> > On 23 June 2010 21:45, Rob Beard  > > wrote:
> >
> > Hi folks,
> >
> > I'm trying to setup Shoutcast on a VPS server for a mate of mine as a
> > favour.  The VPS server is running Ubuntu 8.04 AMD64.
> >
> > Now I gather from reading up, it is recommended that the shoutcast
> > daemon is run as a user rather than root (presumably for security
> > purposes).
> >
> > The thing is, I can't figure out how to do it.  At first I thought of
> > creating an init script, but presumably it'll run as root?
> >
> > I also thought about cron, but I guess that would require me to enter
> a
> > start time (so if the server goes down say in the middle of the day
> then
> > it'll have to wait until the start time in the crontab?)
> >
> > So I wondered if there was any way of running the shoutcast daemon as
> > another user basically from when the machine boots?
> >
> >
> > You can set the user and group in the security stanza of the
> > configuration file. You can then launch it from an init script and it
> > should run as the user.
> >
> > Running it from cron is also valid, but you run a script every minute
> > (or whatever interval you want) that checks for the pid file or running
> > process and restarts the server if it can't find one or the other.
> >
> > Icecast is better documented and more actively supported than shoutcast
> > on Linux - the old shoutcast documentation doesn't seem to exist anymore.
> >
> > s/
> >
>
> Thanks Simon and Neil,
>
> I've used Icecast in the past, seems much better than Shoutcast as far
> as documentation goes.  I'm not sure why he specifically needs Shoutcast.
>
> I don't suppose you know if Icecast is compatible with Shoutcast is it?
>  (I mean for streaming to the server, at the moment I'm using Winamp
> with the Shoutcast DSP plugin to send the audio to the server and then
> the Gnome Movie Player app to play the stream).
>
>
Icecast is the same code as shoutcast but open source. I'm not sure if it
supports mp3 out of the box with Ubuntu but it does eventually (I haven't
used it for years to be honest).

s/


-- 
Save BBC 6 Music http://www.love6music.com
My CV: http://bit.ly/sfgreenwood_cv
Linkedin: http://www.linkedin.com/in/simonfgreenwood
Twitter: @sfgreenwood
-- 
ubuntu-uk@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-uk
https://wiki.ubuntu.com/UKTeam/


Re: [ubuntu-uk] Running daemon at startup as another user

2010-06-23 Thread Rob Beard
On 23/06/10 22:09, Simon Greenwood wrote:
>
>
> On 23 June 2010 21:45, Rob Beard  > wrote:
>
> Hi folks,
>
> I'm trying to setup Shoutcast on a VPS server for a mate of mine as a
> favour.  The VPS server is running Ubuntu 8.04 AMD64.
>
> Now I gather from reading up, it is recommended that the shoutcast
> daemon is run as a user rather than root (presumably for security
> purposes).
>
> The thing is, I can't figure out how to do it.  At first I thought of
> creating an init script, but presumably it'll run as root?
>
> I also thought about cron, but I guess that would require me to enter a
> start time (so if the server goes down say in the middle of the day then
> it'll have to wait until the start time in the crontab?)
>
> So I wondered if there was any way of running the shoutcast daemon as
> another user basically from when the machine boots?
>
>
> You can set the user and group in the security stanza of the
> configuration file. You can then launch it from an init script and it
> should run as the user.
>
> Running it from cron is also valid, but you run a script every minute
> (or whatever interval you want) that checks for the pid file or running
> process and restarts the server if it can't find one or the other.
>
> Icecast is better documented and more actively supported than shoutcast
> on Linux - the old shoutcast documentation doesn't seem to exist anymore.
>
> s/
>

Thanks Simon and Neil,

I've used Icecast in the past, seems much better than Shoutcast as far 
as documentation goes.  I'm not sure why he specifically needs Shoutcast.

I don't suppose you know if Icecast is compatible with Shoutcast is it? 
  (I mean for streaming to the server, at the moment I'm using Winamp 
with the Shoutcast DSP plugin to send the audio to the server and then 
the Gnome Movie Player app to play the stream).

Rob

-- 
ubuntu-uk@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-uk
https://wiki.ubuntu.com/UKTeam/


Re: [ubuntu-uk] Running daemon at startup as another user

2010-06-23 Thread Simon Greenwood
On 23 June 2010 21:45, Rob Beard  wrote:

> Hi folks,
>
> I'm trying to setup Shoutcast on a VPS server for a mate of mine as a
> favour.  The VPS server is running Ubuntu 8.04 AMD64.
>
> Now I gather from reading up, it is recommended that the shoutcast
> daemon is run as a user rather than root (presumably for security
> purposes).
>
> The thing is, I can't figure out how to do it.  At first I thought of
> creating an init script, but presumably it'll run as root?
>
> I also thought about cron, but I guess that would require me to enter a
> start time (so if the server goes down say in the middle of the day then
> it'll have to wait until the start time in the crontab?)
>
> So I wondered if there was any way of running the shoutcast daemon as
> another user basically from when the machine boots?
>
>
You can set the user and group in the security stanza of the configuration
file. You can then launch it from an init script and it should run as the
user.

Running it from cron is also valid, but you run a script every minute (or
whatever interval you want) that checks for the pid file or running process
and restarts the server if it can't find one or the other.

Icecast is better documented and more actively supported than shoutcast on
Linux - the old shoutcast documentation doesn't seem to exist anymore.

s/

-- 
Save BBC 6 Music http://www.love6music.com
My CV: http://bit.ly/sfgreenwood_cv
Linkedin: http://www.linkedin.com/in/simonfgreenwood
Twitter: @sfgreenwood
-- 
ubuntu-uk@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-uk
https://wiki.ubuntu.com/UKTeam/


Re: [ubuntu-uk] Running daemon at startup as another user

2010-06-23 Thread Neil Greenwood
On 23 June 2010 21:45, Rob Beard  wrote:
> I'm trying to setup Shoutcast on a VPS server for a mate of mine as a
> favour.  The VPS server is running Ubuntu 8.04 AMD64.
>[snip]
> The thing is, I can't figure out how to do it.  At first I thought of
> creating an init script, but presumably it'll run as root?
>

Write an init script that uses sudo or su to run the shoutcast daemon
as another user?

You shouldn't need to enter a password if you run su as root, IIRC.


Cofion,
Neil.

-- 
ubuntu-uk@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-uk
https://wiki.ubuntu.com/UKTeam/


[ubuntu-uk] Running daemon at startup as another user

2010-06-23 Thread Rob Beard
Hi folks,

I'm trying to setup Shoutcast on a VPS server for a mate of mine as a 
favour.  The VPS server is running Ubuntu 8.04 AMD64.

Now I gather from reading up, it is recommended that the shoutcast 
daemon is run as a user rather than root (presumably for security purposes).

The thing is, I can't figure out how to do it.  At first I thought of 
creating an init script, but presumably it'll run as root?

I also thought about cron, but I guess that would require me to enter a 
start time (so if the server goes down say in the middle of the day then 
it'll have to wait until the start time in the crontab?)

So I wondered if there was any way of running the shoutcast daemon as 
another user basically from when the machine boots?

Rob

-- 
ubuntu-uk@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-uk
https://wiki.ubuntu.com/UKTeam/