|
1 | | -### Troubleshooting Failed SSH Connection |
| 1 | +--- |
| 2 | +title: Connect to UNO Q via Secure Shell (SSH) |
| 3 | +description: Learn how to access an UNO Q's shell via SSH. |
| 4 | +tags: [UNO Q, SSH, Terminal] |
| 5 | +author: Karl Söderby |
| 6 | +--- |
| 7 | + |
| 8 | +The [Arduino® UNO Q](https://store.arduino.cc/products/uno-q) can be programmed via the [Arduino App Lab](/software/app-lab/), a desktop application supporting code editing and running [Apps](/software/app-lab/tutorials/getting-started/#create--run-apps) on the board without any external tools. |
| 9 | + |
| 10 | +The board's microprocessor (running Debian OS) can also be accessed using Secure Shell (SSH), a method that allows remote connection to your board over a local network. This allows you to among other things: |
| 11 | +- Access the board's shell and perform operations on the board remotely. |
| 12 | +- Transfer files from your local computer to the board remotely (using SCP) |
| 13 | + |
| 14 | +The UNO Q board comes pre-packaged with the Arduino App Lab, which is based on the `arduino-app-cli` tool<sup>1</sup> This allows you among other things, to **launch Apps through the command line**, instead of using the desktop App. |
| 15 | + |
| 16 | +<sup>1</sup> Read more about the `arduino-app-cli` in the [Arduino App CLI guide](/software/app-lab/tutorials/cli/) |
| 17 | + |
| 18 | +## Requirements |
| 19 | + |
| 20 | +### Hardware Requirements |
| 21 | + |
| 22 | +- [Arduino® UNO Q](https://store.arduino.cc/products/uno-q) |
| 23 | +- 5 VDC 3 A power supply (e.g. a phone charger or USB port from computer) |
| 24 | + |
| 25 | +### Software Requirements |
| 26 | + |
| 27 | +- [First setup](/software/app-lab/tutorials/getting-started/#install--set-up-arduino-app-lab) of board completed\* |
| 28 | +- A SSH client tool installed on computer (MacOS, Windows 10+, Ubuntu has built-in SSH client tools) |
| 29 | +- Access to local Wi-Fi® network (both computer & board needs to be on the same network) |
| 30 | + |
| 31 | +***During the first setup, Wi-Fi® credentials are entered, and the board will automatically enable SSH - without completing it, it is not possible to access the board via SSH unless activated manually.*** |
| 32 | + |
| 33 | + |
| 34 | +## Installing SSH (Local Computer) |
| 35 | + |
| 36 | +SSH is a network protocol, and not a tool itself. There are many different SSH tools to choose from, and most operating systems has a built-in tool. In this section, we will cover how to set it up on some common operating systems (MacOS, Windows, Ubuntu). |
| 37 | + |
| 38 | +### MacOS |
| 39 | + |
| 40 | +MacOS features a built-in `ssh` tool based on [OpenSSH](https://www.openssh.com/), and **should work out of the box**. Check if the tool is present on your machine by running the following in a terminal: |
| 41 | + |
| 42 | +```sh |
| 43 | +ssh -V |
| 44 | +``` |
| 45 | + |
| 46 | +You should see something like: |
| 47 | + |
| 48 | +```sh |
| 49 | +OpenSSH_9.9p2, LibreSSL 3.3.6 |
| 50 | +``` |
| 51 | + |
| 52 | +Which means it is working properly. ✅ |
| 53 | + |
| 54 | +***If you are running an outdated/custom system that for some reason does not feature SSH, you can look into installing [OpenSSH](https://formulae.brew.sh/formula/openssh) and [LibreSSL](https://formulae.brew.sh/formula/libressl) manually via e.g. Brew.*** |
| 55 | + |
| 56 | +### Windows |
| 57 | + |
| 58 | +Later versions of Windows (10+) include SSH clients as well, with no requirement to install additional tools. To verify tools are installed, open a terminal on your Windows machine, and type: |
| 59 | + |
| 60 | +```sh |
| 61 | +ssh -V |
| 62 | +``` |
| 63 | + |
| 64 | +Which should return something like: |
| 65 | + |
| 66 | +```sh |
| 67 | +OpenSSH_for_Windows_x.x, LibreSSL 3.x.x |
| 68 | +``` |
| 69 | + |
| 70 | +This means it is working properly. ✅ |
| 71 | + |
| 72 | +***For older Windows machines, use a package manager such as [Chocolatey](https://chocolatey.org/) to install the OpenSSH / LibreSSL.*** |
| 73 | + |
| 74 | +### Linux (Ubuntu) |
| 75 | + |
| 76 | +Many Linux OS include SSH clients, with no requirement to install additional tools. To verify tools are installed, open a terminal on your Windows machine, and type: |
| 77 | + |
| 78 | +```sh |
| 79 | +ssh -V |
| 80 | +``` |
| 81 | + |
| 82 | +Which should return something like: |
| 83 | + |
| 84 | +```sh |
| 85 | +OpenSSH_x.x Ubuntu-3ubuntu.x, OpenSSL x.x.x |
| 86 | +``` |
| 87 | + |
| 88 | +This means it is working properly. ✅ |
| 89 | + |
| 90 | +***If you are running an outdated/custom system that for some reason does not feature SSH, you can look into installing [OpenSSH](https://formulae.brew.sh/formula/openssh) and [LibreSSL](https://formulae.brew.sh/formula/libressl) manually, by running `sudo apt install openssh-client openssh-server libressl-dev`.*** |
| 91 | + |
| 92 | +## Connecting via SSH |
| 93 | + |
| 94 | +To connect to an UNO Q board via SSH, we only need to know the **board name and password**. This is setup during the first setup. |
| 95 | + |
| 96 | +1. Open a terminal |
| 97 | +2. Run the following command: |
| 98 | + |
| 99 | + ```sh |
| 100 | + ssh arduino@<boardname>.local #replace <boardname> with your boardname |
| 101 | + ``` |
| 102 | + |
| 103 | +3. Type `yes` when asked to connect. |
| 104 | +4. Enter the password for the board. |
| 105 | + |
| 106 | +After entering the password, we should be entering the board's shell, and we can now perform operations! |
| 107 | + |
| 108 | +See below how it should look like when we have successfully accessed the board's shell. |
| 109 | + |
| 110 | +### MacOS Confirmation |
| 111 | + |
| 112 | + |
| 113 | + |
| 114 | +### Windows Confirmation |
| 115 | + |
| 116 | + |
| 117 | + |
| 118 | +### Linux (Ubuntu) Confirmation |
| 119 | + |
| 120 | + |
| 121 | + |
| 122 | +## Arduino App CLI |
| 123 | + |
| 124 | +The `arduino-app-cli` can be used to start & stop Apps on the board from the terminal. When accessing the board via SSH, we can run commands such as `arduino-app-cli app start <app>`. |
| 125 | + |
| 126 | +More details on the `arduino-app-cli` tool can be found in the [Arduino App CLI guide](/software/app-lab/tutorials/cli/). |
| 127 | + |
| 128 | +## File Transfer |
| 129 | + |
| 130 | +To transfer files from your computer to the board, use the `scp` tool. The tool can be used to either **push** or **pull** files to and from the board. |
| 131 | + |
| 132 | +This is done by specifying a local path on your computer (e.g. `/User/documents/file.xx`), and a path on the board (e.g. `/home/arduino/`). |
| 133 | + |
| 134 | +### Push Files |
| 135 | + |
| 136 | +To **push** a file, use the command below: |
| 137 | + |
| 138 | +```sh |
| 139 | +scp test-transfer.txt arduino@<boardname>.local:/home/arduino/ |
| 140 | +``` |
| 141 | + |
| 142 | +This will transfer the `test-transfer.txt` file in the same directory you are running the command, to the board. |
| 143 | + |
| 144 | +### Pull Files |
| 145 | + |
| 146 | +To **pull** a file, use the command below: |
| 147 | + |
| 148 | +```sh |
| 149 | +scp arduino@<boardname>.local:/home/arduino/test-transfer.txt ./ |
| 150 | +``` |
| 151 | + |
| 152 | +This will pull the file to the directory where you run the command. `./` can be replaced by specifying a path (e.g. `/User/documents/`). |
| 153 | + |
| 154 | + |
| 155 | +## Troubleshooting |
2 | 156 |
|
3 | 157 | If the SSH connection fails, there are some common things to check out: |
4 | | -- Has the first setup been completed? If not, go to [First Setup](/learn/first-setup) and see the instructions. The first setup will enable SSH on the board which is required to connect. |
| 158 | +- Has the first setup been completed? If not, follow the instructions at [here](/software/app-lab/tutorials/getting-started/#install--set-up-arduino-app-lab) and see the instructions. The first setup will enable SSH on the board which is required to connect. |
5 | 159 | - If the SSH connection gets stuck even though first setup has been completed, it may be a local network issue. Check that the board is connected to the same network as our computer. |
6 | 160 |
|
7 | | -### Issues with mDNS |
| 161 | +### Issues with MDNS |
8 | 162 |
|
9 | 163 | Some networks may block using mDNS, which allows us to use a "friendly" name (`arduino@<boardname>.local`), instead of using the actual IP address of the board. There are two ways to work around this: |
10 | | -1. Instead of using `arduino@<boardname>.local`, use the board's IP address directly. |
11 | | -2. (advanced) Edit the `/etc/hosts` on your local computer. |
| 164 | +1. Instead of using `arduino@<boardname>.local`, use the board's IP address directly. The IP address can be accessed by either launching board in SBC mode, and typing `hostname -I` in a terminal. This will reveal the IP address of your board. |
| 165 | +2. (advanced) Edit the `/etc/hosts` on your local computer by running `sudo nano /etc/hosts`. In the bottom of the file, add `<boardipaddress> <boardname>.local`. This will allow you to connect using `ssh arduino@<boardname>.local`. |
0 commit comments