Différences
Ci-dessous, les différences entre deux révisions de la page.
— | tutoriel:nanopc:raspi:ssh:start [2022/11/08 19:41] (Version actuelle) – créée admin | ||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
+ | {{tag> | ||
+ | ====== Accès SSH à un Raspberry PI depuis un PC du réseau ====== | ||
+ | |||
+ | ===== Pré-requis ===== | ||
+ | |||
+ | ===== Première étape : localiser le Raspberry Pi sur le réseau ===== | ||
+ | |||
+ | Installez-vous sur le PC du réseau à relier au Raspberry Pi. | ||
+ | |||
+ | Retrouvez le Raspberry Pi sur le réseau en lançant :< | ||
+ | PING raspberrypi.local (192.168.0.21) 56(84) bytes of data. | ||
+ | 64 bytes from 192.168.0.21 (192.168.0.21): | ||
+ | |||
+ | --- raspberrypi.local ping statistics --- | ||
+ | 1 packets transmitted, | ||
+ | rtt min/ | ||
+ | </ | ||
+ | |||
+ | On constate que : | ||
+ | * le Raspberry Pi est connecté en 192.168.0.31 | ||
+ | * La connexion SSH est disponible. | ||
+ | |||
+ | ===== Autres étapes ===== | ||
+ | |||
+ | ==== Lancer une session ssh ==== | ||
+ | |||
+ | Lancez une session SSH sur l' | ||
+ | Warning: the ECDSA host key for ' | ||
+ | Offending key for IP in / | ||
+ | Matching host key in / | ||
+ | Are you sure you want to continue connecting (yes/no)? yes | ||
+ | pi@raspberrypi.local' | ||
+ | Linux raspberrypi 4.19.118-v7+ #1311 SMP Mon Apr 27 14:21:24 BST 2020 armv7l | ||
+ | |||
+ | The programs included with the Debian GNU/Linux system are free software; | ||
+ | the exact distribution terms for each program are described in the | ||
+ | individual files in / | ||
+ | |||
+ | Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent | ||
+ | permitted by applicable law. | ||
+ | Last login: Thu Jul 30 21:32:10 2020 | ||
+ | |||
+ | SSH is enabled and the default password for the ' | ||
+ | This is a security risk - please login as the ' | ||
+ | |||
+ | pi@raspberrypi: | ||
+ | </ | ||
+ | * A la première connexion, répondez **yes** pour accepter la demande d’autorisation de clé de cryptage du SSH | ||
+ | * A la demande de mot de passe, tapez **raspberry** (réglage d' | ||
+ | * En dernière ligne, le prompt confirme que vous n' | ||
+ | <WRAP center round info 60%> | ||
+ | En cas de réinstallation, | ||
+ | <cli> | ||
+ | ...:~$ ssh pi@192.168.0.31 | ||
+ | @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ | ||
+ | @ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! | ||
+ | @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ | ||
+ | ... | ||
+ | remove with: | ||
+ | ssh-keygen -f "/ | ||
+ | ... | ||
+ | Host key verification failed. | ||
+ | </ | ||
+ | |||
+ | Dans ce cas, faites comme demandé : | ||
+ | < | ||
+ | et recommencez. | ||
+ | </ | ||
+ | |||
+ | ==== Accéder au Raspberry Pi via SSH sans fournir de mot de passe ==== | ||
+ | |||
+ | Pour ne pas avoir à fournir le mot de passe à chaque connexion SSH au Raspberry Pi, | ||
+ | * placez-vous sur le PC et tapez :< | ||
+ | Generating public/ | ||
+ | Enter file in which to save the key (/ | ||
+ | Enter passphrase (empty for no passphrase): | ||
+ | Enter same passphrase again: | ||
+ | Your identification has been saved in / | ||
+ | Your public key has been saved in / | ||
+ | The key fingerprint is: | ||
+ | SHA256: | ||
+ | The key's randomart image is: | ||
+ | +---[DSA 1024]----+ | ||
+ | | . .oXo| | ||
+ | | . o o B +| | ||
+ | | . | ||
+ | | o + . O + . . | | ||
+ | |. = o * S o . | | ||
+ | | . o + * o . | | ||
+ | |. . + = =... | | ||
+ | | . + + ..+. | | ||
+ | |... . . .. | | ||
+ | +----[SHA256]-----+ | ||
+ | ...: | ||
+ | </ | ||
+ | * Envoyez au Raspberry Pi la clé publique ainsi générée :< | ||
+ | ...:~$ ssh-copy-id pi@192.168.0.31 | ||
+ | / | ||
+ | / | ||
+ | pi@192.168.0.31' | ||
+ | |||
+ | Number of key(s) added: 2 | ||
+ | |||
+ | Now try logging into the machine, with: " | ||
+ | and check to make sure that only the key(s) you wanted were added. | ||
+ | </ | ||
+ | * Reconnectez-vous au Raspberry Pi :< | ||
+ | * Déconnectez-vous. Maintenant, vous pouvez vous connecter au Raspberry Pi via SSH sans mot de passe. | ||
+ | |||
+ | Pour automatiser cette connexion, | ||
+ | * créez avec les droits d' | ||
+ | Host framboise | ||
+ | User pi | ||
+ | Hostname 192.168.0.31 | ||
+ | # framboise.local | ||
+ | Port 22 | ||
+ | CheckHostIP no | ||
+ | LocalForward 5900 127.0.0.1: | ||
+ | Compression yes | ||
+ | ForwardX11 yes | ||
+ | </ | ||
+ | |||
+ | Il suffit maintenant de : | ||
+ | < | ||
+ | * sous l' | ||
+ | * sans mot de passe | ||
+ | * et en mode graphique | ||
+ | |||
+ | ===== Conclusion ===== | ||
+ | |||
+ | ===== Problèmes connus ===== | ||
+ | ??? Problème sous Ubuntu 18.04 | ||
+ | < | ||
+ | sign_and_send_pubkey: | ||
+ | Les autorisations de fichier sont trop ouvertes (0644). | ||
+ | !!! **Solution** | ||
+ | Les changer ainsi : | ||
+ | < | ||
+ | ??? | ||
+ | |||
+ | ===== Voir aussi ===== | ||
+ | |||
+ | * **(fr)** [[http:// | ||
+ | |||
+ | ---- | ||
+ | //Basé sur << [[http:// |