You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The docs say the host and container users must have the same uid/gid. Since my host user gitea has uid/gid of 500, I set that in my docker-compose.yml:
The /data/git/.ssh/ directory and /data/git/.ssh/authorized_keys file must both have mode 1000:1000.
So:
The error is misleading because it says AddPublicKey: addKey: open /data/git/.ssh/authorized_keys: permission denied and that sent me on a wild goose chase... it should say something like AddPublicKey: addKey: open /data/git/.ssh/: permission denied when the directory itself is inaccessible
MORE IMPORTANT: the docs say that the git user on the host and container must have matching uid/gid but this isn't true. The directories and files on the host must have mode 1000:1000regardless of the uid/gid of the host git user.
There are many related issues for this underlying problem, and people report "fixing it" by changing mode/permissions without really understanding what happens (and possibly weakening their securiy). So this is a widespread issue.
Description
I followed the docs for an ssh shim passthrough.
The docs say the host and container users must have the same uid/gid. Since my host user
gitea
has uid/gid of500
, I set that in mydocker-compose.yml
:The mapped
.ssh
directory has this (wheregitea
is 500:500 as above):When I try to add an ssh key in the website, it shows an internal server error (500), and the logs show this:
So the container's
git
user cannot access/data/git/.ssh/authorized_keys
.So I ran
docker exec
into the container, and ran$ id git
, which gives:So the container still uses the default uid/gid of
1000
instead of my500
override. That's why it can't access the file.Is this a bug?
Gitea Version
1.19.3
Can you reproduce the bug on the Gitea demo site?
No
Log Gist
No response
Screenshots
No response
Git Version
2.39.2
Operating System
debian
How are you running Gitea?
docker
Database
SQLite
The text was updated successfully, but these errors were encountered: