4.0 Enabling SSH and Connecting Via Ethernet
Now that we've got a console up and running, we've got a way to enter commands, read and write files, and do a bunch of great stuff. However, there are certain advantages to using ssh to connect to the board, so I want to cover that real quickly before we get into Yocto.
4.1 Enabling SSH
By default, ssh is not enabled in Raspbian, but it is installed. To start up the sshd server, all we have to do is type:
$ sudo systemctl start ssh
You won't see any response to this command, but if you do a ps -ef | grep ssh, you should see the sshd process listed like so:
4.2 Manually Setting an IP Address
Typically when doing embedded development work, I like to connect directly from my computer to my boards over Ethernet instead of going through a router. This means that they're not being assigned an IP address since there is no router to provide DHCP services. We'll set the ip address of the board manually using the ip command like so:
$ ip addr add 169.254.1.100/24 dev eth0
This will set up a subnet mask of 255.255.255.0 and assign the IP address of 169.254.1.100 to the Ethernet port, which is mapped to /dev/eth0.
4.3 Connecting an Ethernet Cable and SSH'ing In
On the host computer, set the IP address to something like:
IPV4 Address : 169.254.1.10
Subnet Mask : 255.255.255.0
Gateway : 169.254.1.1
After connecting an Ethernet cable from your host computer to the Raspberry Pi, you should be able to open a terminal and type:
$ ssh pi@169.254.1.100
With any luck, the connection will work and you'll see the following message:
A word of warning: if you are connected to your home router, I'd definitely recommend changing the password right away!
← Previous    ...    Next →