Hier werden die Unterschiede zwischen zwei Versionen gezeigt.
| Beide Seiten, vorherige Überarbeitung Vorherige Überarbeitung Nächste Überarbeitung | Vorherige Überarbeitung | ||
|
admin_grundlagen:ssh [2023/12/27 10:45] ingo_wichmann [mit authorized_keys command] |
admin_grundlagen:ssh [2025/08/14 12:24] (aktuell) ingo_wichmann [Syntax prüfen] |
||
|---|---|---|---|
| Zeile 69: | Zeile 69: | ||
| ===== Public-Key auf anderen Rechner übertragen ===== | ===== Public-Key auf anderen Rechner übertragen ===== | ||
| - | ssh-copy-id -i .ssh/id_ed25519.pub nutzer05@notebook06 | + | ssh-copy-id nutzer05@notebook06 |
| oder von Hand: | oder von Hand: | ||
| ssh nutzer05@notebook06 'mkdir -m 700 ~/.ssh' | ssh nutzer05@notebook06 'mkdir -m 700 ~/.ssh' | ||
| Zeile 77: | Zeile 77: | ||
| ===== Serverseitig Passwortauthentifizierung abschalten ===== | ===== Serverseitig Passwortauthentifizierung abschalten ===== | ||
| - | <file txt /etc/ssh/sshd_config> | + | <file txt /etc/ssh/sshd_config.d/keyonly.conf> |
| - | UsePAM no | + | UsePAM yes |
| + | KbdInteractiveAuthentication no | ||
| PasswordAuthentication no | PasswordAuthentication no | ||
| </file> | </file> | ||
| - | Alternativ (CentOS 7) | + | ==== Syntax prüfen ==== |
| - | <file txt /etc/ssh/sshd_config> | + | sshd -t |
| - | UsePAM yes | + | |
| - | ChallengeResponseAuthentication no | + | ==== Dienst neu starten ==== |
| - | PasswordAuthentication no | + | systemctl restart ssh.service |
| - | </file> | + | |
| ===== ssh-agent ===== | ===== ssh-agent ===== | ||
| Zeile 102: | Zeile 102: | ||
| ===== Nutzer Zugriff beschränken ===== | ===== Nutzer Zugriff beschränken ===== | ||
| ==== mit authorized_keys command ==== | ==== mit authorized_keys command ==== | ||
| - | //Problem: die Datei ''~/.ssh/authorized_keys'' gehört dem Nutzer, den man einschränken möchte. Mögliche Lösung: AuthorizedKeysCommand und AuthorizedKeysCommandUser // | + | //Problem: die Datei ''~/.ssh/authorized_keys'' gehört dem Nutzer, den man einschränken möchte. Mögliche Lösung: AuthorizedKeysFile, AuthorizedKeysCommand und AuthorizedKeysCommandUser // |
| <file txt ~/.ssh/authorized_keys> | <file txt ~/.ssh/authorized_keys> | ||