View unanswered posts    View active topics

All times are UTC - 6 hours





Post new topic Reply to topic  [ 8 posts ] 
Print view Previous topic   Next topic  
Author Message
Search for:
PostPosted: Mon Jul 06, 2009 2:14 pm 
Offline
Joined: Tue Jul 15, 2008 6:57 pm
Posts: 24
So I have firefox and flash installed in R6 (both installed using pacman). When I run firefox as mythtv flash objects appear fine. However, if as mythtv I do "sudo -u mythtv firefox", then firefox doesn't appear to load the flash plugin properly (it won't display them, and flash is not listed in about:plugins). How can I get flash to work properly in this case?

(The reason I'm trying to do this is that I'm setting up a php script that will allow me to open web pages on my mythbox. So on my laptop I can browse to a youtube video, open a bookmarklet that sends my current URL to my php script on the myth box, and the video opens and plays on my tv. Except right now it opens and complains that flash isn't installed.)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 06, 2009 4:47 pm 
Offline
Joined: Sun May 29, 2005 5:47 pm
Posts: 65
My guess is that the enviroment variables are not being set correctly. I know there is a difference between "su mythtv" and "su - mythtv" as the latter reads the login shell among other things. For sudo, it looks like the option you are looking for is "-i". Try the following:

Code:
sudo -u mythtv -i firefox


If that works, be sure to post your .php script. Sounds like a handy feature.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jul 06, 2009 6:00 pm 
Offline
Joined: Tue Jul 15, 2008 6:57 pm
Posts: 24
Woo, I got it working. It was indeed the environmental variables, specifically MOZ_PLUGIN_PATH; thanks mark.

For anyone interested, here is what I did:
1) add the following to the sudoers file:
Code:
# Defaults specification
Defaults:http   env_keep+=MOZ_PLUGIN_PATH
# User privilege specification
http    ALL=(mythtv) NOPASSWD: /usr/bin/firefox.bin


(restricting the host part as well probably wouldn't hurt either.)

2) create /data/srv/httpd/htdocs/launchURL.php:
Code:
<html>
<body>
<?
$plugin="/usr/lib/mozilla/plugins:/opt/mozilla/lib/plugins"; //set as appropriate
$url=$_GET['url']; //maybe do some sanity checks to avoid exploits?
exec("export DISPLAY=:0 && export XAUTHORITY=/home/mythtv/.Xauthority && sudo -u mythtv -H -b MOZ_PLUGIN_PATH=\"$plugin\" /usr/bin/firefox.bin \"$url\" > /dev/null &");
echo "done:$url";
?>
</body>
</html>


3) Create a firefox bookmarklet on my laptop:
Code:
javascript:location%20=%20'http://mythtv/launchURL.php?url='+escape(location);%20void%200


So now I can browse to a web page on my laptop, click on the bookmarklet, and it automatically sends me to http://mythtv/launchURL.php?url=[url], which then pops up on my tv!

NOTE:
Obviously this shouldn't be done on a box that is exposed to the 'net. I imagine it'd be pretty easy to cook up an "url" that would turn into running a command or something. My mythbox is on my internal network, so I didn't bother doing much to avoid that.


Last edited by LastToKnow0 on Thu Sep 23, 2010 9:25 pm, edited 2 times in total.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 02, 2010 8:48 am 
Offline
Joined: Thu Feb 25, 2010 10:34 am
Posts: 1
mark60050 wrote:
My guess is that the enviroment variables are not being set correctly. I know there is a difference between "su mythtv" and "su - mythtv" as the latter reads the login shell among other things. For sudo, it looks like the option you are looking for is "-i". Try the following:

Code:
sudo -u mythtv -i firefox


If that works, be sure to post your .php script. Sounds like a handy feature.



Yeah that's right this same thing I did last time, I'm so glad it works.


_________________
Blogging Every Where | My Blogging Net | SEO Alaminos | RF Outsource


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 01, 2010 5:36 am 
Offline
Joined: Tue Mar 30, 2010 7:43 pm
Posts: 1
But it dose not work in my Fire Fox
Why??????? :(

_________________
sleeping ear plugs


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 02, 2010 5:31 pm 
Offline
Joined: Fri Nov 03, 2006 6:25 pm
Posts: 47
Location: Montreal, Quebec
Sounds promising,

The bookmarklet works, it sends the link to my myth, firefox opens but not to the proper url, always opens to home page, any ideas anyone??
I'd love to make this work !

I have even tried to start firefox locally on myth, via command line supplying a link like
Code:
/usr/bin/firefox www.linhes.org


still no go, opens whatever home page is.
Help please!


Top
 Profile  
 
 Post subject:
PostPosted: Sun Sep 19, 2010 5:50 pm 
Offline
Joined: Tue Jul 15, 2008 6:57 pm
Posts: 24
This script will start opening the correct URL again (at least, it did for me) if you change both the sudoers file and the php file to refer to /usr/bin/firefox.bin instead of /usr/bin/firefox. I guess /usr/bin/firefox doesn't pass parameters through, for some reason? I've updated my previous post.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 23, 2010 9:23 pm 
Offline
Joined: Tue Jul 15, 2008 6:57 pm
Posts: 24
I also figured out why restricting http to running as mythtv wasn't working: my php script wasn't actually trying to run as mythtv. Dur. I've edited my post above again to fix this.


Top
 Profile  
 

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 


All times are UTC - 6 hours




Who is online

Users browsing this forum: No registered users and 18 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group

Theme Created By ceyhansuyu