Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow Gitea to run as different USER in Docker #3961

Merged
merged 8 commits into from
May 16, 2018
Merged
2 changes: 1 addition & 1 deletion docker/etc/s6/gitea/setup
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,5 @@ if [ ! -f /data/gitea/conf/app.ini ]; then
envsubst < /etc/templates/app.ini > /data/gitea/conf/app.ini
fi

chown -R git:git /data/gitea /app/gitea /data/git
chown -R ${USER}:git /data/gitea /app/gitea /data/git
chmod 0755 /data/gitea /app/gitea /data/git
7 changes: 7 additions & 0 deletions docker/usr/bin/entrypoint
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
#!/bin/sh

if [ "${USER}" != "git" ]; then
# rename user
sed -i -e "s/git\:/${USER}\:/g" /etc/passwd
# switch sshd config to different user
sed -i -e "s/AllowUsers git/AllowUsers ${USER}/g" /etc/ssh/sshd_config
fi

## Change GID for USER?
if [ -n "${USER_GID}" ] && [ "${USER_GID}" != "`id -g ${USER}`" ]; then
sed -i -e "s/^${USER}:\([^:]*\):[0-9]*/${USER}:\1:${USER_GID}/" /etc/group
Expand Down