Ssh schnelleinstieg: Unterschied zwischen den Versionen

Aus Xinux Wiki
Zur Navigation springen Zur Suche springen
Zeile 47: Zeile 47:
 
directory
 
directory
 
*scp -r /bin harald@rechner:/tmp
 
*scp -r /bin harald@rechner:/tmp
 +
==Schlüsselpaar erstellen==
 +
*ssh-keygen
 +
<pre>
 +
Generating public/private rsa key pair.
 +
Enter file in which to save the key (/root/.ssh/id_rsa):
 +
Enter passphrase (empty for no passphrase):
 +
Enter same passphrase again:
 +
Your identification has been saved in /root/.ssh/id_rsa.
 +
Your public key has been saved in /root/.ssh/id_rsa.pub.
 +
The key fingerprint is:
 +
SHA256:EuZ8a0Ovlq5ZdXXOsUUMH2pPT3NzD8k8bbfXkjq9nsg root@unaris
 +
The key's randomart image is:
 +
+---[RSA 2048]----+
 +
|              .+.|
 +
|            o.=o|
 +
|      o      oB=@|
 +
|    + .    ..oX#|
 +
|      + S . . o+B|
 +
|      + + . o ..|
 +
|        =.. o .  |
 +
|      +oo . o o |
 +
|      o+o  E.+  |
 +
+----[SHA256]-----+
 +
<pre>

Version vom 21. November 2019, 21:10 Uhr

Verbindungsaufbau vereinfacht

Ssh-1.png

Server

Installation

  • apt-get install ssh

Konfig Verzeichnis

/etc/ssh

Konfigurationsdatei

Beispiel

  • cat /etc/ssh/sshd
Port 22
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_ecdsa_key
HostKey /etc/ssh/ssh_host_ed25519_key
PermitRootLogin prohibit-password
ChallengeResponseAuthentication no
UsePAM yes
X11Forwarding yes
PrintMotd no
AcceptEnv LANG LC_*
Subsystem sftp  /usr/lib/openssh/sftp-server
PasswordAuthentication yes

start,stop,restart,status

  • systemctl start ssh
  • systemctl stop ssh
  • systemctl status ssh
  • systemctl restart ssh

Client

Konfigurations Verzeichnis

/etc/ssh

Heimat Verzeichnis

~/.ssh

remote login

  • ssh harald@rechner
  • ssh -l harald rechner
  • ssh -p 22 -l harald rechner

Ausführen eines Programs auf einem anderem Rechner

  • ssh harald@rechner date
  • ssh harald@rechner pwd
  • ssh harald@rechner ls -l

Secure copy

local to remote

file

  • scp /etc/hosts harald@rechner:/tmp

directory

  • scp -r /bin harald@rechner:/tmp

Schlüsselpaar erstellen

  • ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:EuZ8a0Ovlq5ZdXXOsUUMH2pPT3NzD8k8bbfXkjq9nsg root@unaris
The key's randomart image is:
+---[RSA 2048]----+
|              .+.|
|             o.=o|
|      o      oB=@|
|     + .    ..oX#|
|      + S . . o+B|
|       + + . o ..|
|        =.. o .  |
|       +oo . o o |
|      o+o   E.+  |
+----[SHA256]-----+