ssh

Siehe auch scp.

Allgemein

ssh -l USER -p PORT DOMAIN
ssh USER@DOMAIN

Tunnel (Remote Port-Forwarding)

alesana

ssh -nNT -R \*:9000:localhost:9981 -i .ssh/fahrrad-wiki.org_id_rsa -p64000 singlespeedfahrer@fahrrad-wiki.org

SSH ohne Passwort

lokal

1. Zertifikat erstellen:

ssh-keygen -b 4096

2. Übertragen auf remote-Server:

ssh-copy-id -i .ssh/key_rsa.pub singlespeedfahrer@fahrrad-wiki.org

remote

Falls key noch nicht übertragen:

cat key_rsa.pub » /.ssh/authorized_keys

in der /etc/ssh/sshd_config:

PasswordAuthentication no

lokal

ssh -p 64000 singlespeedfahrer@fahrrad-wiki.org

Fehlermeldungen

Received disconnect from ... Too many authentication failures for ...

Received disconnect from EXTERNAL_HOST: 2: Too many authentication failures for USER from LOCAL_HOST port 57684 ssh2 Disconnected from EXTERNAL_HOST

Mögliche Lösungen:

ohne PubKey:

ssh -o PubkeyAuthentication=no USER@EXTERNAL_HOST

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.

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 offered, until 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:

Host www.somehost.com IdentityFile ~/.ssh/key_for_somehost_rsa IdentitiesOnly yes Port 22

If you use the ssh-agent, it helps to run ssh-add -D to clear the identities.

If you are not using any ssh hosts configuration, you have to explicitly specify the correct key in the ssh command like so:

ssh -i some_id_rsa -o 'IdentitiesOnly yes' them@there:/path/

Note: the 'IdentitiesOnly yes' parameter needed to be between quotes.

or

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

Siehe auch

SSH auf dem Server absichern unter Debian