SSH passthrough into Docker failed: Permission denied (publickey). #8807

Closed
opened 2025-11-02 08:19:18 -06:00 by GiteaMirror · 1 comment
Owner

Originally created by @Dexus on GitHub (Apr 10, 2022).

Description

I tried https://docs.gitea.io/en-us/install-with-docker/#ssh-shell-with-authorizedkeyscommand and https://docs.gitea.io/en-us/install-with-docker/#docker-shell-with-authorizedkeyscommand

both end ma back

ssh -v -i "H:\Dropbox\...Josef.openssh" git@git.xxxx.biz
OpenSSH_for_Windows_8.1p1, LibreSSL 3.0.2
debug1: Reading configuration data C:\\Users\\josef/.ssh/config
debug1: Connecting to git.xxxx.biz [xxx.xxx.xxx.xxx] port 22.
debug1: Connection established.
debug1: identity file H:\\Dropbox\\....Josef.openssh type -1
debug1: identity file H:\\Dropbox\\...Josef.openssh-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_for_Windows_8.1
debug1: Remote protocol version 2.0, remote software version OpenSSH_8.2p1 Ubuntu-4ubuntu0.4
debug1: match: OpenSSH_8.2p1 Ubuntu-4ubuntu0.4 pat OpenSSH* compat 0x04000000
debug1: Authenticating to git.xxxx.biz:22 as 'git'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:JEDLiiKEi7sIjMyLNhHzeTBzUK8R0vpev9H8CqOlBys
debug1: Host 'git.xxxx.biz' is known and matches the ECDSA host key.
debug1: Found key in C:\\Users\\josef/.ssh/known_hosts:5
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey in after 134217728 blocks
debug1: pubkey_prepare: ssh_get_authentication_socket: No such file or directory
debug1: Will attempt key: H:\\Dropbox\\....Josef.openssh  explicit
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,sk-ssh-ed25519@openssh.com,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,sk-ecdsa-sha2-nistp256@openssh.com>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: H:\\Dropbox\\...Josef.openssh
debug1: Authentications that can continue: publickey
debug1: No more authentication methods to try.
git@git.xxxx.biz: Permission denied (publickey).

/usr/bin/ssh -p 2222 -o StrictHostKeyChecking=no git@127.0.0.1 /usr/local/bin/gitea keys -e git -u git -t ssh-rsa -k AAAAB3NzaC1y...

by Hand response to: Gitea: Invalid repository path

/usr/bin/docker exec -i -u git gitea /usr/local/bin/gitea keys -e git -u git -t ssh-rsa -k AAAAB.......

gives:

# gitea public key
command="/usr/local/bin/gitea --config=/data/gitea/conf/app.ini serv key-6",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty,no-user-rc,restrict ssh-rsa AAAAB3NzaC1.....Josef.key

but I get always: `git@git.xxxx.biz: Permission denied (publickey).´ via external ssh /git clone

Gitea Version

1.16.5

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

2.30.x

Operating System

docker

How are you running Gitea?

via docker

Database

MySQL

Originally created by @Dexus on GitHub (Apr 10, 2022). ### Description I tried https://docs.gitea.io/en-us/install-with-docker/#ssh-shell-with-authorizedkeyscommand and https://docs.gitea.io/en-us/install-with-docker/#docker-shell-with-authorizedkeyscommand both end ma back ``` ssh -v -i "H:\Dropbox\...Josef.openssh" git@git.xxxx.biz OpenSSH_for_Windows_8.1p1, LibreSSL 3.0.2 debug1: Reading configuration data C:\\Users\\josef/.ssh/config debug1: Connecting to git.xxxx.biz [xxx.xxx.xxx.xxx] port 22. debug1: Connection established. debug1: identity file H:\\Dropbox\\....Josef.openssh type -1 debug1: identity file H:\\Dropbox\\...Josef.openssh-cert type -1 debug1: Local version string SSH-2.0-OpenSSH_for_Windows_8.1 debug1: Remote protocol version 2.0, remote software version OpenSSH_8.2p1 Ubuntu-4ubuntu0.4 debug1: match: OpenSSH_8.2p1 Ubuntu-4ubuntu0.4 pat OpenSSH* compat 0x04000000 debug1: Authenticating to git.xxxx.biz:22 as 'git' debug1: SSH2_MSG_KEXINIT sent debug1: SSH2_MSG_KEXINIT received debug1: kex: algorithm: curve25519-sha256 debug1: kex: host key algorithm: ecdsa-sha2-nistp256 debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none debug1: expecting SSH2_MSG_KEX_ECDH_REPLY debug1: Server host key: ecdsa-sha2-nistp256 SHA256:JEDLiiKEi7sIjMyLNhHzeTBzUK8R0vpev9H8CqOlBys debug1: Host 'git.xxxx.biz' is known and matches the ECDSA host key. debug1: Found key in C:\\Users\\josef/.ssh/known_hosts:5 debug1: rekey out after 134217728 blocks debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug1: SSH2_MSG_NEWKEYS received debug1: rekey in after 134217728 blocks debug1: pubkey_prepare: ssh_get_authentication_socket: No such file or directory debug1: Will attempt key: H:\\Dropbox\\....Josef.openssh explicit debug1: SSH2_MSG_EXT_INFO received debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,sk-ssh-ed25519@openssh.com,ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,sk-ecdsa-sha2-nistp256@openssh.com> debug1: SSH2_MSG_SERVICE_ACCEPT received debug1: Authentications that can continue: publickey debug1: Next authentication method: publickey debug1: Trying private key: H:\\Dropbox\\...Josef.openssh debug1: Authentications that can continue: publickey debug1: No more authentication methods to try. git@git.xxxx.biz: Permission denied (publickey). ``` `/usr/bin/ssh -p 2222 -o StrictHostKeyChecking=no git@127.0.0.1 /usr/local/bin/gitea keys -e git -u git -t ssh-rsa -k AAAAB3NzaC1y...` by Hand response to: `Gitea: Invalid repository path` ` /usr/bin/docker exec -i -u git gitea /usr/local/bin/gitea keys -e git -u git -t ssh-rsa -k AAAAB.......` gives: ``` # gitea public key command="/usr/local/bin/gitea --config=/data/gitea/conf/app.ini serv key-6",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty,no-user-rc,restrict ssh-rsa AAAAB3NzaC1.....Josef.key ``` but I get always: `git@git.xxxx.biz: Permission denied (publickey).´ via external ssh /git clone ### Gitea Version 1.16.5 ### Can you reproduce the bug on the Gitea demo site? No ### Log Gist _No response_ ### Screenshots _No response_ ### Git Version 2.30.x ### Operating System docker ### How are you running Gitea? via docker ### Database MySQL
GiteaMirror added the type/bug label 2025-11-02 08:19:18 -06:00
Author
Owner

@lunny commented on GitHub (Apr 20, 2022):

duplicated with #17798

@lunny commented on GitHub (Apr 20, 2022): duplicated with #17798
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#8807