LinHES Forums http://forums.linhes.org/ |
|
Firefox and flash question http://forums.linhes.org/viewtopic.php?f=5&t=20108 |
Page 1 of 1 |
Author: | LastToKnow0 [ Mon Jul 06, 2009 2:14 pm ] |
Post subject: | Firefox and flash question |
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.) |
Author: | mark60050 [ Mon Jul 06, 2009 4:47 pm ] |
Post subject: | |
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. |
Author: | LastToKnow0 [ Mon Jul 06, 2009 6:00 pm ] |
Post subject: | |
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. |
Author: | lucaspolan [ Tue Mar 02, 2010 8:48 am ] |
Post subject: | |
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 |
Author: | DarlynRoger [ Thu Apr 01, 2010 5:36 am ] |
Post subject: | |
But it dose not work in my Fire Fox Why??????? ![]() |
Author: | smartel [ Fri Apr 02, 2010 5:31 pm ] |
Post subject: | |
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! |
Author: | LastToKnow0 [ Sun Sep 19, 2010 5:50 pm ] |
Post subject: | |
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. |
Author: | LastToKnow0 [ Thu Sep 23, 2010 9:23 pm ] |
Post subject: | |
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. |
Page 1 of 1 | All times are UTC - 6 hours |
Powered by phpBB® Forum Software © phpBB Group http://www.phpbb.com/ |