Connecting to the board's operating system
Now, we need to use an SSH client to connect to the Yocto Linux running on the board and update some libraries that we will use to interact with the board's components and features. Both OS X and Linux include the ssh
command in the Terminal. However, Windows doesn't include an ssh
command and we have to install an SSH client.
In Windows, we can use the free and open source PuTTY SSH and telnet client. However, if you have any other preference for an SSH client in Windows, you can use any other software. The commands we execute in the terminal will be the same no matter what SSH client we use.
We can download and install PuTTY in Windows from http://www.putty.org or http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html. Once you install it, launch it and make sure you allow Windows firewall or any other installed firewall to open the necessary ports to make the connections. You will see warnings popping up depending on the firewall software that is running on Windows.
After you launch PuTTY, the application will display the PuTTY Configuration dialog box. Enter the IP address assigned to your board in the Host Name (or IP address) textbox and leave the Port value to its default 22 value. The following picture shows the dialog box with the settings to connect to the board whose assigned IP is 192.168.1.105. You can leave the default settings. However, you should definitely change the Window | Appearance settings to change the default font.
Click on Open and the first time you want to establish a connection; PuTTY will display a security alert because the server's host key is not cached in the registry. You trust your board and the Yocto Linux that is running on it, and therefore, just click on Yes. The following picture shows the security alert.
PuTTY will display a new window, specifically a terminal window, with the IP address included in the title. You will see the following message asking you to enter the login user.
login as:
Enter root and press Enter. You will login as the root
user that doesn't require a password in the Yocto Linux default configuration. Now, you can run any shell commands. For example, you can enter the following command to check the installed python version:
python --version
The following picture shows a PuTTY terminal window with the results of logging in as root and running a few commands:
In OS X and Linux, you can open a Terminal and run the ssh
command to connect to the Yocto Linux running on the board. You have to enter ssh
followed by a space, the user name, an arrow (@), and the IP. In this case, we want to connect with root as the user name, and therefore, we will enter ssh
followed by a space, root@
, and then the IP address. The following command works with the board that is running the SSH server in the 192.168.1.105
IP address and port number 22. You have to replace 192.168.1.105
with the IP address you retrieved.
ssh root@192.168.1.105
The first time you want to establish a connection, the ssh
command will display a security alert because the authenticity of the host can't be established. You trust your board and the Yocto Linux that is running on it, and therefore, answer yes to a question that will be similar to the following one and press Enter.
The authenticity of host '192.168.1.105 (192.168.1.105)' can't be established. ECDSA key fingerprint is SHA256:Ln7j/g1Np4igsgaUP0ujFC2PPcb1pnkLD8Pk0AK+Vow. Are you sure you want to continue connecting (yes/no)?
The ssh
command will display a message similar to the following line after you answer yes and press Enter:
Warning: Permanently added '192.168.1.105' (ECDSA) to the list of known hosts.
You will log in as the root
user that does not require a password in the Yocto Linux default configuration. Now, you can run any shell command. For example, you can enter the following command to check the installed Python version.
python --version
Notice that while you see the following prompt root@galileo:~#, it means that all your commands are running on the Yocto Linux on the board and not on your OS X Terminal or your Linux Terminal. The following picture shows an OS X Terminal window with the results of logging in as root
and running a few commands:
We can also run any SSH client in a mobile device such as a tablet or smartphone. There are many SSH clients developed for iOS and Android. It is possible to work with a tablet and a Bluetooth keyboard linked to it and easily run the commands in the SSH client.