# Gitea with Snap: unable to access removable drives

**URL:** <https://forum.gitea.com/t/gitea-with-snap-unable-to-access-removable-drives/6294>\
**Category:** Install/Maintain/Configure\
**Created:** [November 21, 2022, 5:44am UTC](https://forum.gitea.com/t/gitea-with-snap-unable-to-access-removable-drives/6294 "2022-11-21T05:44:01Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![japtar10101](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/japtar10101/32/3236_2.png) [@japtar10101](https://forum.gitea.com/u/japtar10101)\
**Post date:** [November 21, 2022, 5:44am UTC](https://forum.gitea.com/t/gitea-with-snap-unable-to-access-removable-drives/6294/1 "2022-11-21T05:44:01Z")

</div>

Hello, all. As title implies, I’ve installed Gitea v1.17.3 on an Ubuntu 22.04.1 LTS server via Snap. On the install page, I changed the repo and lfs directory to `/media/<drive-name-here>/gitea/repo` and `/media/<drive-name-here>/gitea/lfs` respectively. Their permissions are as follows:

```auto
$ pwd
/media/<drive-name-here>/gitea

$ sudo ls -l
total 0
drwxr-x--- 1 git git 0 Nov 21 05:15 lfs
drwxr-x--- 1 git git 0 Nov 21 04:21 repo

```

Despite setting the username to `git`, I would consistently get the notification, `mkdir /media/<drive-name-here>/gitea/data failed: Permission denied`. Just in case, I did run:

```auto
sudo snap connect gitea:removable-media

```

But this didn’t appear to help on install. For now, I’ve installed using the pre-filled variables (i.e. in the `/var/snap/gitea/common/data` directory), but I’m wondering what else I could do to make Gitea have permissions to create files in the `/media` mounted drives.

Also, how do I test if the `removable-media` permission actually worked? Do I edit `/var/snap/gitea/common/conf/app.ini` to the values below?

```auto
RUN_USER = git

[repository]
ROOT = /media/<drive-name-here>/gitea/repo

[lfs]
PATH = /media/<drive-name-here>/gitea/lfs

```

---

<div class="post-metadata">

**Author:** ![jake](https://avatars.discourse-cdn.com/v4/letter/j/f475e1/32.png) [@jake](https://forum.gitea.com/u/jake)\
**Post date:** [December 26, 2022, 9:24pm UTC](https://forum.gitea.com/t/gitea-with-snap-unable-to-access-removable-drives/6294/2 "2022-12-26T21:24:02Z")

</div>

What is the output of `ls -al` in `/media/<drive-name-here>/gitea`? I suspect that folder is not owned by `git:git` or has incorrect permissions set, leading to Gitea being unable to create folders within it.

I am unfamiliar with snap, but it may also be AppArmor related if that is configured.

---

<div class="post-metadata">

**Author:** ![japtar10101](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/japtar10101/32/3236_2.png) [@japtar10101](https://forum.gitea.com/u/japtar10101)\
**Post date:** [January 6, 2023, 12:11am UTC](https://forum.gitea.com/t/gitea-with-snap-unable-to-access-removable-drives/6294/3 "2023-01-06T00:11:19Z")

</div>

> [@jake](#):
>
> `ls -al` in `/media/<drive-name-here>/gitea`

Sorry, was on vacation. Output looks like this:

```auto
$ ls -al /media/<drive-name-here>/gitea
total 16
drwxrwxr-x 1 <me> <me> 14 Nov 21 05:41 .
drwxr-xr-x 1 <me> <me> 86 Nov 21 04:20 ..
drwxr-x--- 1 git git 0 Nov 21 05:15 lfs
drwxr-x--- 1 git git 0 Nov 21 04:21 repo

```

---

<div class="post-metadata">

**Author:** ![jake](https://avatars.discourse-cdn.com/v4/letter/j/f475e1/32.png) [@jake](https://forum.gitea.com/u/jake)\
**Post date:** [January 6, 2023, 12:46am UTC](https://forum.gitea.com/t/gitea-with-snap-unable-to-access-removable-drives/6294/4 "2023-01-06T00:46:49Z")

</div>

No worries. Based on that output, Gitea running as `git` can’t create any files in that directory since your user owns it. A quick `chown git:git /media/<drive-name-here>/gitea` should fix that and allow Gitea to create the `data` folder.

---

<div class="post-metadata">

**Author:** ![japtar10101](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/japtar10101/32/3236_2.png) [@japtar10101](https://forum.gitea.com/u/japtar10101)\
**Post date:** [January 7, 2023, 2:32am UTC](https://forum.gitea.com/t/gitea-with-snap-unable-to-access-removable-drives/6294/5 "2023-01-07T02:32:50Z")

</div>

Hmm, after changing folder permissions, then changing the app.ini to point to these folders, I must have done something wrong when restarting gitea, but gitea web doesn’t seem to be hosting anymore (I get an “Unable to connect” on Firefox.) I have also reverted the app.ini file back to its old settings, but it still had the same problem: I suspect it has nothing to do with changing the permissions on the gitea folder. I’ll try troubleshooting it for a while.
