SSH
Via SSH kun je verbinding maken met een andere computer op het intra of internet. Hiervoor moet er op de computer waarmee je verbinding wilt maken wel een SSH server geinstalleerd zijn en actief zijn.
Als je de conclusie hebt getrokken dat SSH server nog niet geinstalleerd is, installeer deze dan via de volgende commando.
Terminal: sudo apt-get install openssh-server
Om de server te activeren als deze geïnstalleerd is kun je het volgende invoeren.
Terminal: sudo systemctl enable ssh
Om de verbinding tot stand te brengen heb je meestal een wachtwoord en een gebruikersnaam nodig welke bekend is op de computer waar de server draait. De server is niet bekend met de gebruikersnamen van de client.
Terminal: ssh gebruikersnaam@192.168.1.1
Het ipadres is dus het ipadres van de server. Na het invoeren van het commando log je in met het wachtwoord.
Bij vaak gebruik van SSH kan het op een gegeven moment handig zijn om niet telkens het wachtwoord opnieuw in te vullen. Je kunt je client computer registreren bij de server, zodat je niet telkens het wachtwoord hoeft in te voeren.
Terminal: ssh-keygen -t rsa -b 2048
Hiermee creëer je een lokale key op de client. Deze key id moet gekopieerd worden naar de server
Terminal: ssh-copy-id gebruikersnaam@192.168.1.1
Als het goed is, wordt dit de laatste keer dat je het wachtwoord hebt ingevoerd
Hoewel je nu niet meer een wachtwoord hoeft in te voeren kan het nog wel zijn om een fingerprint te bevestigen.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])?
Terminal: ssh -o "StrictHostKeyChecking no" gebruikersnaam@192.168.1.1
Je zou de melding moeten krijgen: “Warning: Permanently added ‘192.168.2.90’ (ED25519) to the list of known hosts.”, echter bij een melding: “Failed to add the host to the list of known hosts” kun je het probleem oplossen door de volgende commando in te voeren:
Terminal: sudo chown -v clientgebruikersnaam ~/.ssh/known_hosts
Incidenteel kan het voorkomen dat even goed je nog steeds een wachtwoord moet ingeven. Dit kan veroorzaakt worden door een rechten probleem in de $HOME directorie van de server. Je kunt dit aanpassen door middel van de volgende commando op de server:
chmod g-w ~/
chmod o-wx ~/
Reacties
SSH — Geen reacties
HTML tags allowed in your comment: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>