Skip to content

Documentation for SSH is not correct for Alpine linux (fixes in the description) #19065

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

Closed
williamdes opened this issue Mar 12, 2022 · 7 comments · Fixed by #19067
Closed

Documentation for SSH is not correct for Alpine linux (fixes in the description) #19065

williamdes opened this issue Mar 12, 2022 · 7 comments · Fixed by #19067

Comments

@williamdes
Copy link

Gitea Version

1.16.x

Git Version

No response

Operating System

No response

How are you running Gitea?

Using docker compose

Database

MySQL

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Description

I have the following error message in my logs by sshd: fatal: reprocess config line 122: AuthorizedKeysCommand must be an absolute path

After applying https://docs.gitea.io/en-us/install-with-docker/#ssh-shell-with-authorizedkeyscommand

What was needed on my Alpine 3.14 was this diff:

- AuthorizedKeysCommand ssh -p 2222 -o StrictHostKeyChecking=no [email protected] /usr/local/bin/gitea keys -c /data/gitea/conf/app.ini -e git -u %u -t %t -k %k
+ AuthorizedKeysCommand /usr/bin/ssh -p 2222 -o StrictHostKeyChecking=no [email protected] /usr/local/bin/gitea keys -c /data/gitea/conf/app.ini -e git -u %u -t %t -k %k

And after the forwarding worked fine after another tweak

I had this error in my logs and git clone failed fetch commands ..s/setting/setting.go:952:loadFromConf() [F] Expect user 'git' but current user is: root
Solved by adding -u git in the step https://docs.gitea.io/en-us/install-with-docker/#docker-shell-with-authorizedkeyscommand
Please note on the step above the -u git is here, maybe this is also a mistake. See: https://docs.gitea.io/en-us/install-with-docker/#docker-shell-with-authorized_keys

Screenshots

No response

mscherer added a commit to mscherer/gitea that referenced this issue Mar 12, 2022
@mscherer
Copy link
Contributor

Given openssh man pages, this doesn't seems to be a Alpine specific issue, so I fixed the 1st issue in the doc.

@williamdes
Copy link
Author

Given openssh man pages, this doesn't seems to be a Alpine specific issue, so I fixed the 1st issue in the doc.

Thank you so much !

What about the -u git one ?

@mscherer
Copy link
Contributor

For the 2nd part, I am not sure to really understand where the problem come from. Is the issue in the docker-shell wrapper, as there is already a -u on the AuthorizedKeysCommand.

If you could make a PR, it would be clearer to me

@williamdes
Copy link
Author

For the 2nd part, I am not sure to really understand where the problem come from. Is the issue in the docker-shell wrapper, as there is already a -u on the AuthorizedKeysCommand.

If you could make a PR, it would be clearer to me

There is no -u git in the shell wrapper of https://docs.gitea.io/en-us/install-with-docker/#docker-shell-with-authorizedkeyscommand
But there is one in the wrapper of https://docs.gitea.io/en-us/install-with-docker/#docker-shell-with-authorized_keys

image
image

Does it make more sense ?

6543 pushed a commit that referenced this issue Mar 13, 2022
@mscherer
Copy link
Contributor

Seems the bug was closed by error (or rather closed automatically), I can't reopen myself it seems.

And yes, the wrapper is not the same but I wonder if it should be fixed on the Dockerfile side to force the container to run as the user git, as it would make the doc simpler.

zjjhot added a commit to zjjhot/gitea that referenced this issue Mar 14, 2022
* giteaofficial/main:
  [skip ci] Updated translations via Crowdin
  Fix documentation and go-gitea#19065 (go-gitea#19067)
  RSS/Atom support for Repos (go-gitea#19055)
  [skip ci] Updated licenses and gitignores
  Feeds: render markdown to html (go-gitea#19058)
  [skip ci] Updated translations via Crowdin
@williamdes
Copy link
Author

Seems the bug was closed by error (or rather closed automatically), I can't reopen myself it seems.

And yes, the wrapper is not the same but I wonder if it should be fixed on the Dockerfile side to force the container to run as the user git, as it would make the doc simpler.

Well I tried running the container as git user and that was not the right fix for this issue, I lost quite a lot of time trying this solution.
Finally the -u git worked like a charm and did not destroy my setup
Would you mind making a PR for that ? (I could make one too but I am not setup for gitea dev)

@mscherer
Copy link
Contributor

yes, but the docker container should already run as the git user (or I think it should). Forcing the git user on the Docker exec seems like a workaround for something that shouldn't be needed, as adding USER should make it work out of the box.

Chianina pushed a commit to Chianina/gitea that referenced this issue Mar 28, 2022
@go-gitea go-gitea locked and limited conversation to collaborators Apr 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants