Accessing network shares from Thunderbird

Thunderbird in Linux, for some reason, still does not understand GIO filesystems. If you have a network location connected in your file manager (such as Nautilus) you can browse around, copy files and so on – but Thunderbird cannot see those locations. In particular, it can’t attach files out of those locations, not can it save attachments to those locations. Luckily, gvfs provides a workaround.

It’s amazingly simple: Just navigate to this directory:

/run/user/XXXX/gvfs

… where “XXXX” is your numeric user ID, e.g., 1022 or whatever. … and your shares will be visible in it as subdirectories. Navigate into them, and Thunderbird will be able to use what you find there (as will any other non-GIO-aware applications).

This is my gvfs directory (slightly obfuscated) with two network drives mounted:

kauer@kt:~$ ls /run/user/1022/gvfs
smb-share:server=mynas.wherever,share=homes
smb-share:server=mynas.wherever,share=music

As you can see, the share directories have ugly names, but compared to not having access at all, it’s a small price to pay 🙂 And the last part is the actual share name, so it’s pretty obvious what’s what.

If a given network location is not mounted, it will just not be in the directory.

The above is fine for the more technical of us, but is maybe not so useful (or as memorable) for the average user. To simplify things a little, just put a symbolic link somewhere handy for them, such as in their home directory,  and pointing to their gvfs directory:

ln -s /run/user/XXXX/gvfs mynetworkdrives

Replace “XXXX” with the user’s actual numeric user ID. mynetworkdrives can be anything you like, but I recommend that you do not use “Network” or any other names that can easily confused with names used by programs like file managers. I also recommend that you do not put any spaces in the name.

If the user fred‘s ID were (say) 1111, this would be the command to put the desired link in their home directory:

 sudo ln -s /run/user/1111/gvfs  /home/fred/mynetworkdrives

With the above symbolic link in place, the particular user will be able to browse through the link to find their shares, and things like Thunderbird will be able to do so too.

You may be tempted to save the user (or yourself) one click and make a link directly to one of the directories within the gvfs directory. This will work fine – as long as the user is connected to that network location! If the network location is not connected, the user will get an ugly error message. Some file managers – notably Nautilus – will mark the link as broken and stop displaying it to the user. That can be rectified by connecting to the share and clicking “View->Reload”, but it’s probably best to avoid the situation altogether.

Leave a Reply

Your email address will not be published. Required fields are marked *