this post was submitted on 10 Sep 2025
22 points (86.7% liked)

Selfhosted

51294 readers
930 users here now

A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.

Rules:

  1. Be civil: we're here to support and learn from one another. Insults won't be tolerated. Flame wars are frowned upon.

  2. No spam posting.

  3. Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it's not obvious why your post topic revolves around selfhosting, please include details to make it clear.

  4. Don't duplicate the full text of your blog or github here. Just post the link for folks to click.

  5. Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).

  6. No trolling.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

founded 2 years ago
MODERATORS
 

So I initially had been using gitea. It took me a while to get ssh to work properly but then it did. Then I learned of forgejo and decided to go full foss. Only problem is that i cant get ssh to work for the life of me. Here’s my setup

  • Forgejo is in a docker compose file in which I’ve setup a docker network
  • My ssh port for my server is not 22
  • I followed the gitea sshing shim directions I used previously to a T and couldn’t get any sort of anything to work

My best guess is there’s some base configuration difference between the two that I don’t know of that maybe somebody here can point out for me. Any help would be appreciated, thanks.

top 6 comments
sorted by: hot top controversial new old
[–] suzune@ani.social 10 points 9 hours ago (1 children)

It would help if you explain "it does not work" further. It's a bad desciption of the situation and we cannot look directly at your installation.

[–] galaxy_nova@lemmy.world 0 points 9 hours ago* (last edited 8 hours ago) (3 children)

Ok. The issues lies somewhere in the actual connection. Adding ssh keys to my instance shows up properly in the known keys. Whenever I attempt to connect either on the actual server itself as a test or via trying to clone over ssh or even connect via ssh itself I get public key denials. If you want I can provide you my ssh config on server, my docked compose file, the verbose output of the ssh connections in various facets although they haven’t appeared to be very helpful, or whatever else can be helpful

[–] frongt@lemmy.zip 1 points 1 hour ago

What's in the log on the server?

[–] doeknius_gloek@discuss.tchncs.de 2 points 5 hours ago* (last edited 5 hours ago)

Check the permissions/owner of the authorized_keys file. I'm not at home right now to give you the path to it, but I have had a similar problem after I add a new ssh key to my gitea/forgejo account. It turned out that in doing so, sometimes the permissions change and gitea/forgejo then refuses to use the file. You should see warnings about this in the logs.

In my case the problem is probably rooted within the uid/gid thats used inside the container and/or the nfs mount I use for the container volume. I never bothered to get to the bottom of it though.

[–] suzune@ani.social 2 points 8 hours ago

So sshd is running. The first question is: is it running on the port you expect it to run? The main host can have sshd too and maybe you connect to the wrong port? Did you use a ~/.ssh/config for your forgejo connection?

[–] bruce965@lemmy.ml 2 points 8 hours ago* (last edited 7 hours ago)

Here's my config for reference, which works for me:

name: forgejo
services:
  forgejo:
    image: codeberg.org/forgejo/forgejo:12
    environment:
      - USER_UID=1000
      - USER_GID=1000
    restart: always
    volumes:
      - ./data:/data
      - /etc/timezone:/etc/timezone:ro
      - /etc/localtime:/etc/localtime:ro
    ports:
      #- 80:3000
      - 2222:22
    networks:
      - nginx
networks:
  nginx:
    name: nginx
    external: true

If you can share your error message we might be able to better pinpoint the issue.

EDIT: I searched a bit and now I understand better what you are trying to do. I didn't know about this "SSH shim" idea. This is not what I have done on my setup, sorry.