Benutzer-Werkzeuge

Webseiten-Werkzeuge


linux:ssh

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Beide Seiten der vorigen RevisionVorhergehende Überarbeitung
Nächste Überarbeitung
Vorhergehende Überarbeitung
linux:ssh [2015/12/24 12:40] – [Received disconnect from ... Too many authentication failures for ...] movelinux:ssh [2019/09/16 19:57] (aktuell) – [lokal] move
Zeile 8: Zeile 8:
  
 > ssh USER@DOMAIN > ssh USER@DOMAIN
 +
 +===== Erzwinge Passwort-Authentifikation =====
 +<Code:bash>
 +ssh -o PreferredAuthentications=password -o PubkeyAuthentication=no me@host
 +</Code>
 +
 +===== Removes all keys belonging to hostname from a known_hosts file.  =====
 +
 +This option is useful to delete hashed hosts.
 +
 +<Code:bash>
 +ssh-keygen -f "/home/me/.ssh/known_hosts" -R 192.168.0.14
 +</Code>
 +
 +===== Keys für ein besteimmte IP entfernen =====
 +<Code:bash>
 +Warning: the ECDSA host key for 'example.com' differs from the key for the IP address '116.203.XX.XXX'
 +Offending key for IP in /home/me/.ssh/known_hosts:58
 +Matching host key in /home/me/.ssh/known_hosts:3
 +Are you sure you want to continue connecting (yes/no)?
 +</Code>
 +
 +Lösung:
 +<Code:bash>
 +ssh-keygen -R 116.203.XX.XXX
 +</Code>
  
 ===== Tunnel (Remote Port-Forwarding) ===== ===== Tunnel (Remote Port-Forwarding) =====
  
-==== alesana ====+==== Beispiel ====
  
-> ssh -nNT -R  \*:9000:localhost:9981 -i .ssh/fahrrad-wiki.org_id_rsa -p64000 singlespeedfahrer@fahrrad-wiki.org+> ssh -nNT -R  \*:9000:localhost:9981 -i .ssh/example.com_id_rsa -p64000 me@example.com
  
 ===== SSH ohne Passwort ===== ===== SSH ohne Passwort =====
Zeile 25: Zeile 51:
 **2. Übertragen auf remote-Server:** **2. Übertragen auf remote-Server:**
  
-> ssh-copy-id -i .ssh/key_rsa.pub singlespeedfahrer@fahrrad-wiki.org+> ssh-copy-id -i .ssh/key_rsa.pub me@example.com
  
 ==== remote ==== ==== remote ====
Zeile 39: Zeile 65:
 ==== lokal ==== ==== lokal ====
  
-> ssh -p 64000 singlespeedfahrer@fahrrad-wiki.org +> ssh -p 64000 me@example.com 
  
 ===== Fehlermeldungen ===== ===== Fehlermeldungen =====
Zeile 47: Zeile 73:
 > Received disconnect from EXTERNAL_HOST: 2: Too many authentication failures for USER from LOCAL_HOST port 57684 ssh2 > Received disconnect from EXTERNAL_HOST: 2: Too many authentication failures for USER from LOCAL_HOST port 57684 ssh2
 > Disconnected from EXTERNAL_HOST > Disconnected from EXTERNAL_HOST
 +
 +Das wird in der Regel dadurch verursacht, dass dem Server mehrere Keys angeboten werden. Der Server akzeptiert keine Schlüssel mehr, nachdem ihm zuviele Keys angeboten werden.
 +
 +Überprüfen läßt sich das mit dem -v Flag. 
  
 === Mögliche Lösungen: === === Mögliche Lösungen: ===
Zeile 55: Zeile 85:
 **mit Pubkey:** **mit Pubkey:**
  
-This is usually caused by inadvertently offering multiple ssh keys to the server. The server will reject any key after too many keys have been offered. +Um das zu verhindernkann man den Key explizit in jedem Host-Eintrag in der ~/.ssh/config festlegen indem IdentitiesOnly definiert wird:
- +
-You can see this for yourself by adding the -v flag to your ssh command to get verbose output. You will see that a bunch of keys are offereduntil the server rejects the connection saying: "Too many authentication failures for [user]". Without verbose mode, you will only see the ambiguous message "Connection reset by peer"+
- +
-To prevent irrelevant keys from being offered, you have to explicitly specify this in every host entry in the ~/.ssh/config file by adding IdentitiesOnly like so:+
  
 +Beispiel 1
 > Host www.somehost.com > Host www.somehost.com
 >   IdentityFile ~/.ssh/key_for_somehost_rsa >   IdentityFile ~/.ssh/key_for_somehost_rsa
Zeile 66: Zeile 93:
 >   Port 22 >   Port 22
  
-If you use the ssh-agent, it helps to run ssh-add -D to clear the identities.+Beispiel 2 
 +> Host somehost 
 +>   IdentityFile ~/.ssh/key_for_somehost_rsa 
 +>   IdentitiesOnly yes 
 +>   HostName www.somehost.com 
 +>   Port 22 
 +Fall ssh-agent verwendet wird, hilf es, ssh-add -D zu starten um die Identitäten zu säubern.
  
-If you are not using any ssh hosts configuration, you have to explicitly specify the correct key in the ssh command like so:+Ohne die ssh-Host-Konfiguration geht das mit:
  
 > ssh -i some_id_rsa -o 'IdentitiesOnly yes' them@there:/path/ > ssh -i some_id_rsa -o 'IdentitiesOnly yes' them@there:/path/
  
-Note: the 'IdentitiesOnly yes' parameter needed to be between quotes. +oder
- +
-or+
  
 > ssh -i some_id_rsa -o IdentitiesOnly=yes them@there:/path/ > ssh -i some_id_rsa -o IdentitiesOnly=yes them@there:/path/
  
-//Von https://superuser.com/questions/187779/too-many-authentication-failures-for-username/187790#187790//+//Von https://superuser.com/questions/187779/too-many-authentication-failures-for-username/187790#187790 // 
 + 
 +==== Fehler: sign_and_send_pubkey: signing failed: agent refused operation ==== 
 +<Code> 
 +ssh me@host 
 + 
 +sign_and_send_pubkey: signing failed: agent refused operation 
 +me@host: Permission denied (publickey). 
 +</Code> 
 + 
 +Lösung:  
 + 
 +Problem liegt an gnome-keyring. 
 +<Code> 
 +ssh-add ~/.ssh/id_rsa 
 +</Code> 
 ===== Siehe auch ===== ===== Siehe auch =====
   * [[linux:ssh_auf_dem_server_absichern_unter_debian|SSH auf dem Server absichern unter Debian]]   * [[linux:ssh_auf_dem_server_absichern_unter_debian|SSH auf dem Server absichern unter Debian]]
 +  * [[sftp als root auf Server ohne root-ssh-Login]]
 +  * [[sshfs]]
linux/ssh.1450960811.txt.gz · Zuletzt geändert: (Externe Bearbeitung)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki