Linux - why is cache dir located in /home

Discuss various technical topics not related to Mozilla.
Post Reply
User avatar
Nettkrawler
Posts: 137
Joined: May 3rd, 2010, 3:31 pm

Linux - why is cache dir located in /home

Post by Nettkrawler »

Hi.

Why are Firefox using the /home dir to store cache rather than /var or /tmp?

On my Linux Lite installation, Firefox is storing the files in
/home/nettkrawler/.cache/mozilla
and according to QDirStat the folder occupies about 400 MB of space.

Wouldn't it be a better idea storing that under /var?
User avatar
smsmith
Moderator
Posts: 19979
Joined: December 7th, 2004, 8:51 pm
Location: Indiana

Re: Linux - why is cache dir located in /home

Post by smsmith »

Wouldn't /var or /tmp be accessible to all system users? Wouldn't that be a security concern?

More a "tech" topic then a Fx topic, as I believe all *nix systems would use a folder in /home for their cache.
Give a man a fish, and he eats for a day. Teach a man to fish, and he eats for a lifetime.
I like poetry, long walks on the beach and poking dead things with a stick.
Please do not PM me for personal support. Keep posts here in the Forums instead and we all learn.
User avatar
Nettkrawler
Posts: 137
Joined: May 3rd, 2010, 3:31 pm

Re: Linux - why is cache dir located in /home

Post by Nettkrawler »

Yes you're probably right about security concerns. But what data is to get from cache anyway if somebody would want to hack and see all my 'dirty activity' on the web? It is a complete different folder than the user profile is located.
User avatar
Grumpus
Posts: 13236
Joined: October 19th, 2007, 4:23 am
Location: ... Da' Swamp

Re: Linux - why is cache dir located in /home

Post by Grumpus »

The cache folder should be a hidden folder.
Right click on the folder and you should be able to read the permission levels tab.
Since it's yours these can be modified but be careful as Firefox needs access to parts.
Once you close Firefox you can review the specific sub-folders folder and see what has been removed,
This relates to how you have your cache settings in /Edit /Preferences/History.
You could also go to Ubuntu or Mint forums for a more detailed answer.
You should also note depending on the the distro various sub-folders might not be accessible except with admin(root) privilege.
Doesn't matter what you say, it's wrong for a toaster to walk around the house and talk to you
flaneurb
Posts: 622
Joined: December 10th, 2011, 3:50 am

Re: Linux - why is cache dir located in /home

Post by flaneurb »

Most files in /tmp will be deleted on reboot and that may not be the purpose of cache.

I have a locally installed Firefox but no file in ~/.cache is owned by root. You can check this on your system with

Code: Select all

cd .cache
find . -user root
Since the browser's cache is dependent on the user, it makes sense that the cache is in the user's home folder.
User avatar
Grumpus
Posts: 13236
Joined: October 19th, 2007, 4:23 am
Location: ... Da' Swamp

Re: Linux - why is cache dir located in /home

Post by Grumpus »

@flaneurb - to clarify, comment on ownership was for other folders in cache not specifically under Mozilla or Firefox.
Doesn't matter what you say, it's wrong for a toaster to walk around the house and talk to you
User avatar
Nettkrawler
Posts: 137
Joined: May 3rd, 2010, 3:31 pm

Re: Linux - why is cache dir located in /home

Post by Nettkrawler »

File permission isn't an issue. I'm wondering wheter I should do a remove/mount so the files is really being stored into /var - just to save some space regarding to the partitioning. And that will of course only affect my own user profile - any other user profiles wouldn't be affected by that.
Haven't decided yet true to tell.
User avatar
Grumpus
Posts: 13236
Joined: October 19th, 2007, 4:23 am
Location: ... Da' Swamp

Re: Linux - why is cache dir located in /home

Post by Grumpus »

Consider some of the cache folders and files, though deleted or relocated, will regenerate.
Case in point, adjunct files in the startup cache folder, including the folder.
Doesn't matter what you say, it's wrong for a toaster to walk around the house and talk to you
kreemoweet
Posts: 778
Joined: December 30th, 2009, 11:25 pm

Re: Linux - why is cache dir located in /home

Post by kreemoweet »

Standard users do not have permissions to create folders/files in /var in any Linux system I've ever used. That means that Firefox would not be able to store cache files there, unless
special privileges were granted to it. Doing so would violate provisions of the Linux Standard Base. Cache files are not temporary files, and users' home folders have all manner of
caches in them from the programs they run.
Post Reply