Skip to content

Commit b28d3a4

Browse files
Add -u git to docs when using docker exec with root installation (go-gitea#29314)
This fixes a minor issue in the documentation for SSH Container Passthrough for non-rootless installs. The non-rootless Dockerfile and docker-compose do not set `USER`/`user` instructions so `docker exec` will run as root by default. While running as root, gitea commands will refuse to execute, breaking these approaches. For containers built with the rootless instructions, `docker exec` will run as git by default so this is not necessary in that case. This issue was already discussed in go-gitea#19065, but it does not appear this part of the issue was ever added to the documentation.
1 parent 6f4e2e7 commit b28d3a4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

docs/content/installation/with-docker.en-us.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ In this option, the idea is that the host SSH uses an `AuthorizedKeysCommand` in
545545
```bash
546546
cat <<"EOF" | sudo tee /home/git/docker-shell
547547
#!/bin/sh
548-
/usr/bin/docker exec -i --env SSH_ORIGINAL_COMMAND="$SSH_ORIGINAL_COMMAND" gitea sh "$@"
548+
/usr/bin/docker exec -i -u git --env SSH_ORIGINAL_COMMAND="$SSH_ORIGINAL_COMMAND" gitea sh "$@"
549549
EOF
550550
sudo chmod +x /home/git/docker-shell
551551
sudo usermod -s /home/git/docker-shell git
@@ -560,7 +560,7 @@ Add the following block to `/etc/ssh/sshd_config`, on the host:
560560
```bash
561561
Match User git
562562
AuthorizedKeysCommandUser git
563-
AuthorizedKeysCommand /usr/bin/docker exec -i gitea /usr/local/bin/gitea keys -c /data/gitea/conf/app.ini -e git -u %u -t %t -k %k
563+
AuthorizedKeysCommand /usr/bin/docker exec -i -u git gitea /usr/local/bin/gitea keys -c /data/gitea/conf/app.ini -e git -u %u -t %t -k %k
564564
```
565565

566566
(From 1.16.0 you will not need to set the `-c /data/gitea/conf/app.ini` option.)

0 commit comments

Comments
 (0)