Score:1

Accessing html files from / (root) location with Firefox on Ubuntu 22.04

us flag
Moe

I have some .htm files which are stored in the root / directory and I would like to know how to access them in Firefox.

Interestingly enough, I found a solution here: Firefox Quantum : HTML files from internal storage (/usr) do not open which did solve my issue on my Virtual Machine which is running the same Xubuntu 22.04, however since performing a clean installation on a physical machine the same solution has not worked and I just get the following error:

Local HTM loading issue

Despite removing the snap version of Firefox and performing the installation shown in this guide: https://www.omgubuntu.co.uk/2022/04/how-to-install-firefox-deb-apt-ubuntu-22-04 my physical machine just cannot access my local .htm files.

This has never been an issue for me on RHEL environments, and the file path syntax I am using is:

file:///my_dir/my_dir2/index.htm

The directory permissions are:

drwxr-xr-x root root
waltinator avatar
it flag
Keeping your `*.htm` files in `/` is Bad Practice. Don't.
Moe avatar
us flag
Moe
Hello @waltinator I agree with your statement as well, however this is unfortunately the customer's current procedure, and they are unlikely to change that.
waltinator avatar
it flag
consider firing the customer. You could use `inotify` `man -k inotify` to monitor the directory, and, when a `*.htm` file appears (wait for the `close` notification), simply copy `cp`, or link `ln` the file to a more convenient location.
Moe avatar
us flag
Moe
@waltinator I understand that their current method is not considered "best practice" and have voiced my opinion that this directory should be stored outside the `root` file system. I am not here to debate, I just want to learn and understand how I managed to get this working in my VM, but not on the customer's physical machine. From my little experience of `RHEL` environments, this has never been an issue, accessing `.htm` files in the `root` directory. I would be happy to hear your recommendations of a more appropriate location to store their `.htm` files.
waltinator avatar
it flag
"A more appropriate location ... ".On a different disk or partition. That's so the client cannot, by accident, subversion, or intent, fill up `/` and choke your system to a halt. Makes backups easier. Makes it easier to control access. Reduces the SysAdmin's "WTF? `/foo.htm`?, exception (it's allowed), relax" cycle. Makes it easier for the Next SysAdmin, because you'll document your decisions as you persuade Management. When the time comes to give the client more space either by expanding the current partition or moving to a new partition or disk, it's easier. Darn Add comment space limitatio
Moe avatar
us flag
Moe
@waltinator I agree performing backups would be easier by not putting things in `/`, however they currently perform complete disk backups using `clonezilla`. Anyway, I had a thought about creating a new `nologin` user where I could potentially put the `.htm` files in. After doing this, add all other users to this group, then hopefully Firefox would play ball. Like I say, I am still learning, so your thoughts are greatly appreciated, but what do you think of this method?
Score:1
kn flag

Go to the official website of firfox and re-download a firefox.

After the download is complete, you will get a tar.bz2 compressed file. After extract, enter the firefox directory, and use the firefox in this directory to open the html file placed in the root directory smoothly.

tar Jxvf firefox-115.0.3.tar.bz2

cd firefox

./firefox /test.html
Moe avatar
us flag
Moe
Thank you for your suggestion, shockingly this did actually work for me when running Firefox from my user `home` directory, however the moment I moved the Firefox directory to `/usr/lib`, which is where it would normally be located if installed via `apt` and then the same problem occurred. This is interesting though, as it seems like if Firefox is owned by the user who is signed in, then Firefox can access files in `root` without any issue. Looks like I still need to do some more digging into this annoying issue.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.