31 lines
1.1 KiB
Markdown
31 lines
1.1 KiB
Markdown
# SSH
|
|
|
|
Mapping compose: `2222:22` → host 2222 → sshd built-in dell'immagine nel container (porta 22). Lo SSH non passa da Caddy.
|
|
|
|
## Impostazioni coerenti
|
|
```ini
|
|
[server]
|
|
SSH_DOMAIN = your-domain.com
|
|
SSH_PORT = 2222 ; mostrata negli URL
|
|
SSH_LISTEN_PORT = 22 ; porta nel container
|
|
```
|
|
URL clone: `ssh://git@your-domain.com:2222/utente/repo.git`.
|
|
|
|
## Client (`~/.ssh/config`)
|
|
```
|
|
Host your-domain.com
|
|
Port 2222
|
|
User git
|
|
```
|
|
Poi `git clone git@your-domain.com:utente/repo.git`.
|
|
|
|
## Chiavi
|
|
Aggiungere la chiave pubblica in Impostazioni → Chiavi SSH/GPG. Dimensioni minime: ED25519 256, ECDSA 256, RSA 3071, DSA vietato (`[ssh.minimum_key_sizes]`). Test: `ssh -T -p 2222 git@your-domain.com`.
|
|
|
|
## Problemi
|
|
- Porta occupata: cambiare solo la porta host nel compose e `SSH_PORT`.
|
|
- `Permission denied (publickey)`: chiave non registrata o agent sbagliato (`ssh -vT ...`).
|
|
- Dopo restore: `gitea admin regenerate keys` e `hooks`.
|
|
- Le chiavi host SSH del server sono in `gitea-data/ssh`: conservarle per evitare avvisi "host key changed".
|
|
- Dietro NAT: port forwarding anche per 2222.
|