Snap: how to change user from root to git #5906

Closed
opened 2025-11-02 06:39:56 -06:00 by GiteaMirror · 5 comments
Owner

Originally created by @wmutschl on GitHub (Aug 27, 2020).

  • Gitea version (or commit ref): 2.17.1
  • Git version: 2.25.1
  • Operating system: Ubuntu 20.04
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant
  • Log gist:

Description

In my configuration file /var/snap/gitea/common/conf/app.ini the RUN_USER is set to root. Thus my clone urls via ssh look like e.g. ssh://root@git.mutschler.eu:2222/wmutschl/dsge.git. Now, is it possible to change the user to another user-name, for instance set it to git? Or is it that due to snap limitations this has to be set to root? Will there be any caveats by using a different user here?

Originally created by @wmutschl on GitHub (Aug 27, 2020). <!-- NOTE: If your issue is a security concern, please send an email to security@gitea.io instead of opening a public issue --> <!-- 1. Please speak English, this is the language all maintainers can speak and write. 2. Please ask questions or configuration/deploy problems on our Discord server (https://discord.gg/gitea) or forum (https://discourse.gitea.io). 3. Please take a moment to check that your issue doesn't already exist. 4. Please give all relevant information below for bug reports, because incomplete details will be handled as an invalid report. --> - Gitea version (or commit ref): 2.17.1 - Git version: 2.25.1 - Operating system: Ubuntu 20.04 - Database (use `[x]`): - [ ] PostgreSQL - [ ] MySQL - [ ] MSSQL - [x] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [ ] No - [x] Not relevant - Log gist: ## Description In my configuration file `/var/snap/gitea/common/conf/app.ini` the `RUN_USER` is set to `root`. Thus my clone urls via ssh look like e.g. `ssh://root@git.mutschler.eu:2222/wmutschl/dsge.git`. Now, is it possible to change the user to another user-name, for instance set it to `git`? Or is it that due to snap limitations this has to be set to `root`? Will there be any caveats by using a different user here?
GiteaMirror added the type/question label 2025-11-02 06:39:56 -06:00
Author
Owner

@wmutschl commented on GitHub (Sep 6, 2020):

Just an update, it was no problem to change the name. However, I don't use the snap version anymore due to other issues.

@wmutschl commented on GitHub (Sep 6, 2020): Just an update, it was no problem to change the name. However, I don't use the snap version anymore due to other issues.
Author
Owner

@spacehobo commented on GitHub (Nov 16, 2020):

I appreciate that the original poster no longer needs this, but it is a valid concern. I understand that apparmor is protecting things here, but I would prefer not to have things running as root when all they need is filesystem access and (in my case) high-numbered ports.

Could this issue please be re-opened?

@spacehobo commented on GitHub (Nov 16, 2020): I appreciate that the original poster no longer needs this, but it is a valid concern. I understand that apparmor is protecting things here, but I would prefer not to have things running as root when all they need is filesystem access and (in my case) high-numbered ports. Could this issue please be re-opened?
Author
Owner

@lunny commented on GitHub (Nov 16, 2020):

It seems no user defined on snapcraft.yml?

@lunny commented on GitHub (Nov 16, 2020): It seems no user defined on `snapcraft.yml`?
Author
Owner

@spacehobo commented on GitHub (Nov 16, 2020):

It's possible that's related. Note that I don't mind if by default it runs as root, so long as I can configure it not to via the /var/snap/gitea/common/conf/app.ini file.

@spacehobo commented on GitHub (Nov 16, 2020): It's possible that's related. Note that I don't mind if by default it runs as root, so long as I can configure it not to via the `/var/snap/gitea/common/conf/app.ini` file.
Author
Owner

@wmutschl commented on GitHub (Nov 16, 2020):

Exactly, one can simply configure it in the app.ini.

@wmutschl commented on GitHub (Nov 16, 2020): Exactly, one can simply configure it in the app.ini.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#5906