Connecting to raspberry pi via ssh For remote maintenance via command line, an SSH connection to Raspberry Pi must be established.

What is SSH?
On the local system you need an SSH client and the IPv4 address of Raspberry Pi. For computer systems with Mac OS and Linux, the SSH client is already integrated on the command line. Here you only have to call a terminal program.
Under Windows you also have to install an SSH client (eg PuTTY).
Note: Since Raspbian Jessie image of 2016-11-25, SSH is disabled by default for security reasons.
Solution with Mac OS or Linux: Build SSH connection
First you call a terminal program. In the command line, enter the following command. The “HOST” is the IP address or hostname of Raspberry Pi.
ssh pi @ {HOST}
If a connection to the IPv4 address is possible and the default user “pi” exists, you have to enter the password “blind”. This means that the keyboard input is not displayed. It looks like nothing is entered.
raspberry
Then you have to confirm the authenticity of the responding remote station (once). Subsequently, the SSH connection is successfully established.
Note: If you do not enter the username directly into the addressing (pi @ …), then the SSH client tries to log in with the local user. This usually does not work because you are not usually logged in with the same user here.
Solution under Windows: Establish SSH connection
Here, the installation of PuTTY recommends that there is also an executable program without installation. After starting PuTTY, enter the IPv4 address of Raspberry Pi and the username “pi” and the password “raspberry”. It should be “SSH” and the port 22 selected. Then you start the connection with “Connect”. After accepting the certificate (once), the SSH connection is successfully established.
Troubleshooting: Find out the IP address
After the first commissioning of a Raspberry Pi, the connection via SSH is difficult because the IPv4 address of Raspberry Pi was assigned dynamically via DHCP and you do not know it yet. It is easier if you build a connection with the hostname of Raspberry Pi.
Troubleshooting: Establishing a connection after system startup
Since you have no screen output, of course you do not know when Raspberry Pi is done with the system start. Here’s a look at the status LEDs on the board. During system startup, the red LED is permanently lit and the green is flashing or flickering. After completion of the system start, the red LED lights up permanently and the green LED usually stops flashing. Then you can be pretty sure that Raspberry Pi has started successfully and you can connect via SSH.
Troubleshooting: SSH connection with macOS
If you connect to a Raspberry Pi via SSH, then the following error message can occur in a macOS or Linux terminal:
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@
The error message states that the hosthostnameIP address of the remote host does not match the stored public key. This can mean connecting to the wrong host. This can happen if the IP address changes.
The problem is that the connection does not come about, which is correct. An attacker could have sneaked into the connection.
Usually no one pretends to be someone else, but something has changed. For example, the IP address or hostname or even the key. Therefore, as a user, you have to intervene manually to delete the stored authentication data.
Remove the key from macOS:
ssh-keygen -R {IP-ADDRESS/HOSTNAME}
Or delete the whole file:
rm .ssh/known_hosts
Leave a Reply