Ssh Clientseite
Version vom 8. November 2021, 08:40 Uhr von Thomas.will (Diskussion | Beiträge) (→alternativer Aufruf)
Erster Verbindungsaufbau
- alice@u3:~$ ssh bob@u2
The authenticity of host 'u2 (172.16.10.2)' can't be established. ECDSA key fingerprint is SHA256:Dp+DL5apc0A3rsUKCPcvbLSBmb4BSQXDsJGLJR0r0GA. Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
- bob@u2's password:
- bob@u2:~$
Exit
- bob@u2:~$ exit
- alice@u3:~$ cat .ssh/known_hosts
|1|5BdpwWv6AjvkrERbWPK0NCdeWiY=|XEQyvQ0nw5bIIM7UHd6rbJwIA1A= ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBNmNwRv2mqfgV3SwvASy48CIjb4oSmxqcQf7e28dCYQxGRfIXiQK5HYKagkqsfBgai+iIiLKDrkav7tvqX0XsAQ= |1|m9IwDx96MLYRVu8WE49HjWRcdyk=|CVTp1yv65aqMW6Y1zWngj0j1oW8= ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBNmNwRv2mqfgV3SwvASy48CIjb4oSmxqcQf7e28dCYQxGRfIXiQK5HYKagkqsfBgai+iIiLKDrkav7tvqX0XsAQ=
- Der Publikkey des Server u3 wurde hinzugefügt
befehl ausführen
- alice@u3:~$ ssh bob@u2 hostname
- bob@u2's password:
u2
alternativer Aufruf
- alice@u3:~$ ssh -l bob u2
- bob@u2's password:
- bob@u2:~$
Aufruf
- ssh [Optionen] Benutzer@Zielrechner [Kommando]
- Wenn ein Kommando angegeben wird, wird dieses anstelle der Login-Shell ausgeführt.
SSH Optionen
SSH Beispiele
Zugriff auf einen bisher unbekannten Zielrechner
- ssh root@alita
The authenticity of host 'alita (192.168.242.10)' can't be established. RSA key fingerprint is 8c:d1:1f:d2:5e:76:cd:75:74:c4:b7:b2:c7:f6:50:78. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'alita,192.168.242.10' (RSA) to the list of known hosts. root@alita's password: Passwort_das_nicht_angezeigt_wird ... root@alita:~#
Um die Identität des Zielrechners zu verifizieren, kann man den den Fingerprint des öffentlichen RSA Schlüssels auf der Serverseite ausgeben lassen. Dieser kann dann mit dem oben angezeigten verglichen werden.
Zugriff auf bekannten Zielrechner
- ssh root@alita
root@alita's password: Passwort_das_nicht_angezeigt_wird ... root@alita:~#
Zugriff als Benutzer christian und auf Port 9998
- ssh alita -l christian -p 9998
christian@alita's password: Passwort_das_nicht_angezeigt_wird ... christian@alita:~$
Ausführen eines Kommandos auf dem Zielrechner
- ssh alita cat /etc/hostname
root@alita's password: alita root@zero:~#
Ausführen eines grafischen Programms auf dem Zielrechner und lokal anzeigen
- ssh -X root@kvm terminator
Authentifizierung mit Schlüssel
Übertragen des öffentlichen Schlüssels
Ubuntu
- ssh-copy-id -i .ssh/id_rsa.pub root@alita
root@alita's password: Passwort_das_nicht_angezeigt_wird Now try logging into the machine, with "ssh 'root@alita'", and check in: .ssh/authorized_keys to make sure we haven't added extra keys that you weren't expecting.
Einloggen auf Remoterechner
- ssh root@alita
Linux alita 2.6.28-13-generic #44-Ubuntu SMP Tue Jun 2 07:57:31 UTC 2009 i686 The programs included with the Ubuntu system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright. Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. To access official Ubuntu documentation, please visit: http://help.ubuntu.com/ 0 packages can be updated. 0 updates are security updates. Last login: Thu Jul 2 13:54:13 2009 from zero.alpha.quadrant root@alita:~#
