Running as non-root

General discussion about the media server. Feature requests. Hints, tips and tricks.
Locked
divB
Posts:11
Joined:Thu Apr 28, 2011 7:33 pm
AV Hardware:Sony Bravia TV
Running as non-root

Post by divB » Fri Apr 29, 2011 5:51 pm

Hi,

Is there any way/information on how to run the TwonyServer in linux as non-root user?

Regards,
divB

User avatar
parnott
Posts:326
Joined:Mon Sep 20, 2010 9:55 pm
AV Hardware:Twonky, WDTV Live, XBMC (Linux & Windows)

Re: Running as non-root

Post by parnott » Fri Apr 29, 2011 7:52 pm

No, not that I I know of. And, for what specific reason do you want to do this?

divB
Posts:11
Joined:Thu Apr 28, 2011 7:33 pm
AV Hardware:Sony Bravia TV

Re: Running as non-root

Post by divB » Fri Apr 29, 2011 8:19 pm

Hello,

Hmmm :-(

For security purposes. Running such a process as root is really dangerous.

Although running in the own network...

Regards,
divB

User avatar
parnott
Posts:326
Joined:Mon Sep 20, 2010 9:55 pm
AV Hardware:Twonky, WDTV Live, XBMC (Linux & Windows)

Re: Running as non-root

Post by parnott » Fri Apr 29, 2011 8:36 pm

divB wrote:Hello,

Hmmm :-(

For security purposes. Running such a process as root is really dangerous.

Although running in the own network...

Regards,
divB
And who exactly do you think is going breach your security? Your wife, your kids...

Running processes as root is not dangerous on your local network. Now, if you have a completely unsecured network or system then yes it is and you need to fix it.

divB
Posts:11
Joined:Thu Apr 28, 2011 7:33 pm
AV Hardware:Sony Bravia TV

Re: Running as non-root

Post by divB » Fri Apr 29, 2011 8:57 pm

Hi,

If this would be the case then there would be no need for UIDs != 0 and we're back to Windows 9x.

For example, Twonky could have a security flaw which can be used by other malware on the same server/network in order to gain root privileges.

Maybe I will just try to run as non-privileged user. I have access to media files to unprivileged users via ACLs. I think there is nothing more which really needs root privileged.

Regards,
divB

sstodola
Posts:8
Joined:Mon Mar 07, 2011 6:45 pm
AV Hardware:Xbox360

Re: Running as non-root

Post by sstodola » Tue May 17, 2011 12:49 am

Any luck?

divB
Posts:11
Joined:Thu Apr 28, 2011 7:33 pm
AV Hardware:Sony Bravia TV

Re: Running as non-root

Post by divB » Wed May 18, 2011 6:21 pm

I think it shouldnt be a problem but i didnt try.

Im still running as root

sstodola
Posts:8
Joined:Mon Mar 07, 2011 6:45 pm
AV Hardware:Xbox360

Re: Running as non-root

Post by sstodola » Tue May 24, 2011 3:51 am

I got this to work by running these commands.

sudo /etc/init.d/twonkyserver stop
sudo rm /tmp/TwonkyMediaServer-log.txt

#edited to force homedir to twonky location
sudo adduser twonky --home /usr/local/twonkymedia
sudo chown -R twonky:twonky /var/twonkymedia
sudo chown -R twonky:twonky /usr/local/twonkymedia

# I haven't changed my config, but this is stupid that
# twonky creates a directory at the root of your drive
# it should be created in /usr/local/twonkymedia/fooo
sudo chown -R twonky:twonky /twonkymedia

sudo sed -i.bak 's/"\$TWONKYSRV" -D/su twonky -c "\$TWONKYSRV -D"/g' /etc/init.d/twonkyserver

sudo /etc/init.d/twonkyserver start
Last edited by sstodola on Tue Jun 07, 2011 4:44 am, edited 2 times in total.

sstodola
Posts:8
Joined:Mon Mar 07, 2011 6:45 pm
AV Hardware:Xbox360

Re: Running as non-root

Post by sstodola » Tue May 24, 2011 5:08 pm

I do have something odd going on where /usr/local/twonkymedia/twonkymediaserver -D is restarting every 10 minutes or so, but it isn't affecting streaming to my xbox

sstodola
Posts:8
Joined:Mon Mar 07, 2011 6:45 pm
AV Hardware:Xbox360

Re: Running as non-root

Post by sstodola » Wed May 25, 2011 6:58 am

I've edited the set of commands so that it should work. I haven't had an auto restart in 2 hours now.

Locked