8

File manager keeps thumbnails in ~/.thumbnails even after the original photo is deleted.

It's really annoying and I feel like it's insecure if some one can see a photo that I've deleted. I want this folder to be clear. I don't mind if it takes time to show thumbnails of photos. How can I stop thumbnails being saved?

Zanna
  • 70,465
Srinesh
  • 327
  • If you're concerned that people may be watching your ~/.thumbnails then you should also be concerned that they may be watching your images that resulted in the creation of thumbnail files in the first place. The solution to that is usually, depending on the situation and your threat model, discretionary user access control or file or disk encryption. – David Foerster Apr 23 '17 at 12:55

4 Answers4

12

Requires root permissions

I solved this using tmpfs. The thumbnails remain in RAM until the next reboot and are recreated if needed again. Following two lines in /etc/fstab create tmpfs for both thumbnails directories:

none /home/username/.thumbnails tmpfs rw,noexec,nosuid,size=10%,uid=1000,gid=1000,mode=0755 0 0
none /home/username/.cache/thumbnails tmpfs rw,noexec,nosuid,size=10%,uid=1000,gid=1000,mode=0755 0 0

Replace username with your user name and 1000 with your UID and GID. (You can find these by executing the id in shell).

Now clear the directories and mount tmpfs to them.

rm -rf /home/username/.thumbnails/*
sudo mount /home/username/.thumbnails
rm -rf /home/username/.cache/thumbnails/*
sudo mount /home/username/.cache/thumbnails
lukasrozs
  • 163
5

Open file manager (Nautilus), then Edit > Preferences, and a small window will open like this:

Nautilus file manager

Set show thumbnails to never

After this delete all files in the ~/.thumbnails folder to make sure that all thumbnails are deleted and never created again

Zanna
  • 70,465
Alex Jones
  • 7,982
  • 9
  • 55
  • 94
  • 4
    then it's stop showing thumbnails not saving.. i want it to show thumbnails but not to save – Srinesh Dec 08 '14 at 03:00
  • @Srinesh what you said just now is not possible. it can be only one thing. thumbnails will only show when they are saved. this is how every OS works – Alex Jones Dec 08 '14 at 08:05
1

Temp thumbnail Cache using Systemd

I wanted to give a systemd update to this. This is just taking what @lukasrozs already said here https://askubuntu.com/a/809084/1242385 but uses systemd mounts rather than modifying /etc/fstab.

I'm going to assume your thumbnail cache is in a directory like /home/dephekt/.cache/thumbnails and that the user you want to mount this for is UID & GID 1000.

The unit file

[Unit]
Description=Thumbnailer Cache tmpfs mount
ConditionPathIsSymbolicLink=!/home/dephekt/.cache/thumbnails
DefaultDependencies=no
Conflicts=umount.target
Before=local-fs.target umount.target
After=swap.target

[Mount] What=tmpfs Where=/home/dephekt/.cache/thumbnails Type=tmpfs Options=rw,mode=1755,relatime,nosuid,nodev,noexec,size=512M,uid=1000,gid=1000

[Install] WantedBy=local-fs.target

Mount size

You can modify the size=256M mount option to be whatever size you think is sufficient for the thumbnailer cache. I set this to 512M, since my the default maximum cache size for me is 512M. You can find that setting by doing:

$ gsettings get org.gnome.desktop.thumbnail-cache maximum-size
512

Unit file naming

The file needs to be named using the path you used in the Where= argument above, but properly escaped. In my case, the Where= path is /home/dephekt/.cache/thumbnails. To easily determine how systemd would want this to look escaped, you can do:

$ systemd-escape --path --suffix=mount "/home/dephekt/.cache/thumbnails"
home-dephekt-.cache-thumbnails.mount

That gives you exactly what the filename should look like.

Placement & installation

Then place the file in /etc/systemd/system and run:

sudo systemctl daemon-reload
sudo systemctl enable home-dephekt-.cache-thumbnails.mount
sudo systemctl start home-dephekt-.cache-thumbnails.mount

This should cause the mount to happen right now and also automatically after booting.

dephekt
  • 170
1

It's very easy, make thumbnails folder as readable only. You can do it only by sudo. You will have your thumbs in RAM only!

awo3it
  • 29