non-snap version of FF under Ubuntu 22.04?

Keith keithw at caramail.com
Thu Apr 27 20:50:26 UTC 2023


On 4/27/23 1:48 PM, Tommy Trussell wrote:
> On Thu, Apr 27, 2023 at 10:59 AM Volker Wysk <post at volker-wysk.de 
> <mailto:post at volker-wysk.de>> wrote:
> 
>     Am Donnerstag, dem 27.04.2023 um 10:27 -0500 schrieb Tommy Trussell:
>      > As others have said, I use Firefox snap and I've had no problem
>     opening
>      > "random local HTML files."
> 
>     I can't open local HTML files that reside outside of my home
>     directory (and
>     its subdirectories). I can't open, for instance, something in
>     /usr/local/...
> 
>     Can you open files outside, or are you just referring to files in
>     your home
>     directory?
> 
> 
> I was just able to
> 
> $ cd /usr/share/libreoffice/help
> $ firefox  index.html
> 
> that file opened fine.
> 
> HOWEVER you are correct that I cannot open things under /usr/local
> 
> I used sudo to copy a file to /usr/local/temp/test.html
> 
> $ firefox /usr/local/temp/test.html
> 
> Firefox could NOT see that file
> 
> $ sudo firefox /usr/local/temp/test.html
> mkdir: cannot create directory '/run/user/0': Permission denied
> Authorization required, but no authorization protocol specified
> Error: cannot open display: :0
> 
> SO yes you can't open just ANY file. I tinkered with permissions, and 
> despite chown-ing the temp directory and test file, I still could not 
> open it. (NOTE just to be clear, the vast majority of users would NOT 
> want a web browser to be able to modify or even open files anywhere in 
> the file system for security reasons. See Oliver Grawert's comments in 
> this thread.)
> 

Here's the list of permitted directories in my reply to Robert Heller's
post:

/usr/share/doc/{,**} r,
/usr/share/cups/doc-root/{,**} r,
/usr/share/gimp/2.0/help/{,**} r,
/usr/share/gtk-doc/{,**} r,
/usr/share/libreoffice/help/{,**} r,
/usr/share/xubuntu-docs/{,**} r,

It is possible to read files from different locations, but you have to 
take steps to make it work. For instance, if you have some html 
documentation stored in /usr/local/share/doc/mystuff. You can have 
Firefox access those files by bind mounting the directory to another 
under /usr/share/doc/ (or under another of the permitted locations)

$ sudo mkdir /usr/share/doc/mystuff
$ sudo mount --bind /usr/local/share/doc/mystuff /usr/share/doc/mystuff

To make it permanent, set it in /etc/fstab

There seems to be bug, however, in the file-chooser dialog when 
navigating File->Open File in Firefox. You can navigate by pointing and 
clicking to the /usr/share/doc/mystuff directory, but once you click on 
a file, (like index.html) Firefox will open it, but it's path is changed 
to something like file:///run/user/1000/doc/142b32c6/index.html. If 
there are links in index.html to other html files in that mystuff 
directory, they won't be found.

OTOH, if you put file:///usr/share/doc/mystuff/ directly in the address 
bar, Firefox will open the directory for browsing and then you can click 
to open any html files listed therein and the links in them will work. 
The issue with the file-chooser seems to be with the xdg-portal program, 
I believe.

-- 
Keith









More information about the ubuntu-users mailing list