Why is root or gogs user required?


I’m in the process of trying to create a friendly Gogs Docker image that follows best practices. Two of these best practices are: not running as root inside the container, and not running as a specific user.

However, when launching the container as a random UID and attempting to “gogs run web” I am greeted with an error that says “root or sudo / gogs user is required”, effectively.

Why is root / sudo access required? What OS feature/function / escalated privileges are required for gogs to work?


I did some tests and ended up filing a bug (#3114 on GitHub)

With this specific requirement for the “gogs” user it is unlikely that Gogs can ever be deployed to something like OpenShift online.

Any thoughts on where in the code the user check is hardcoded?


There is no requirement for a specific user, you just have to set the user you intend to use in the config.


So I think the issue is actually slightly different. While gogs is happy to run as any user, if it can’t read/write to the config area it will complain about the “gogs” user or “root”, regardless of what user you have configured.

What I need to do is file a GitHub issue about that behavior. The error should be explicitly “I am trying to access stuff in the config area but am unable to”.

If that was the error I would’ve fixed my problem much more quickly.


I also have this issue. I want to use another user (not root or gogs) but I can’t get it to work despite trying everything (i can think of)
I’ve set run user, created the user but it still fails to start


I’m runnig gogs on debian jessie from packages.
I’ve done this:
Initially set up gogs with packages and ran through the wizard, it forced me to use gogs as the user. Fine I continued.
Now I want to change the user.

  • renamed gogs user and group to new user and updated /home/gogs to new user
  • changed /etc/default/gogs to reflect new user
    Changed /etc/gogs/conf/app.ini to new values

no joy, still saying it’s trying to run as gogs (and fails of course)
Used the systemd script and changed relevant variables to new user.
Still no joy.

su - newuser
gogs run web
[…s/setting/setting.go:490 NewContext()] [E] Expect user ‘newuser’ but current user is: gogs

I’m not sure what else to do


Ok, fixed it. Seems like a lot needs doing that is not documented. at least not for a debian packages install
The culprit was /etc/gogs/conf.d/other
There is another USER var that was pointing to gogs.
changed that and we’re back in business


Hi, I also run gogs on debian jessie (both my laptop and my server) without root. However my setup is binary with sqlite. On server I run it under git user and on my laptop as me, no issues at all. I;ve installed this on my virtualbox demo server as full install and also I am able to run this as normal user (no su), without fixing anything at all, it all just works


The same problem, no matter how I configure it, gogs always run as “gogs” user
I want change the user to “git”

CentOS / yum install