sshgitea

gitea: Built-in ssh server not starting when sshd server running


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

Solution

  • 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.