8

How can I grant access to an additional directory (e.g not /home/user) to a snap package?
There is no slot available for directories other than :desktop and :home in snap connections.

Is it possible at all?

  • I don't think it is possible to manually add a folder access. Snaps have their own home directory in ~/snap/ – Jeryosh Mar 25 '20 at 20:46
  • 1
    @JerareYoshi OK.So as far as I see , it's also not possible to add symlinks to other directories in the snap-specific areas.So perhaps the only way to achieve this is to embed all files and folders directly into it . What a ridiculous package manager !!! – Parsa Mousavi Mar 25 '20 at 20:53

2 Answers2

2

You can bind-mount additional directories into your home dir or into ~/snap/<snapname>/current to be able to access them.

(snaps use apparmor to achieve the filesystem access confinement, apparmor does not deal with symlinks, but can handle bind mounts very well instead)

For more information on bind mounts, see this answer on the Unix stackexchange.

Andy J
  • 380
ogra
  • 422
  • 4
  • 4
2

2023 update

It's possible today to manually manage snaps connections.

Examples

  • Grand access to removable medias:

    snap connect [package_name]:removable-media
    

    Replace [package_name] with actual package name (example fslint-unofficial)

  • Grand access to home folder:

    snap connect [package_name]:home
    

    Replace [package_name] with actual package name (example fslint-unofficial)

Read https://snapcraft.io/docs/snapcraft-interfaces for complete interfaces list

Références

brunetton
  • 534
  • 3
    I appreciate the good answer, but it doesn't answer the question(?) removable-media will allow any removable media. What about - say - /a/b/c/? – DarkTrick Jun 17 '24 at 16:02