8

I have a problem with my gitea version 1.15.5 running on my raspberry pi. I appears that the built in ssh server is not starting:

ssh -p 2222 git@myaddress.com
ssh: connect to host myaddress.com port 2222: Connection refused

I already assured that "myaddress.com" points to the correct machine and that the firewall rules are adapted. The web interface works just fine.

When I checked, if the port is actually used by gitea, I realized the built-in ssh server is not running:

sudo lsof -i -P -n | grep LISTEN

sshd        [...]      root    [...]  TCP *:22 (LISTEN)
sshd        [...]      root    [...]  TCP *:22 (LISTEN)
[...]
gitea       [...]       git    [...]  TCP *:3000 (LISTEN)

As you can see, there is no process listening on port 2222. I have an internal sshd server running on that machine at port 22 and I would like to keep those two seperate, if possible. Or is the problem lying there and you can't use the built-in gitea ssh server together with an sshd server?

Here is an excerpt of my app.ini configuration:

APP_NAME = gitea
RUN_USER = git
RUN_MODE = prod

[server]
SSH_DOMAIN       = myaddress.com
DOMAIN           = myaddress.com
HTTP_PORT        = 3000
ROOT_URL         = https://myaddress.com/
DISABLE_SSH      = false
SSH_PORT         = 2222
Benjamin Loison
  • 3,782
  • 4
  • 16
  • 33
Heppi
  • 321
  • 2
  • 7

1 Answers1

14

After some more googling, I found the solution myself:

If there is an sshd server running, gitea does not automatically start its built-in ssh server. Instead, you have to force it by adding this line under [server] in the app.ini configuration:

[server]
START_SSH_SERVER = true

Since, according to the gitea config cheat sheet:

START_SSH_SERVER: false: When enabled, use the built-in SSH server.

I've posted this, in case anyone ever runs into the same problem.

Benjamin Loison
  • 3,782
  • 4
  • 16
  • 33
Heppi
  • 321
  • 2
  • 7
  • 1
    On my Docker image, It seemed like there was already an sshd listening on port 22, though not working with Gitea. So in addition to that configuration option, I also set the internal ssh server listening to an alternate port, with "SSH_PORT=2122". – bgvaughan Mar 12 '23 at 22:22
  • After more wrestling with it, I think the real solution is to switch to the docker-rootless image; apparently the key difference is that it relies on the built-in ssh server. https://docs.gitea.io/en-us/install-with-docker-rootless/ – bgvaughan Mar 13 '23 at 17:30