This section outlines how to create a local tunnel between the module and a PC over USB allowing an SSH connection between the two. This requires that the PC connects both to the micro-USB connector for UART serial communication as well as the USB Type-C connector for SSH.
The instructions below give the steps for setup with an Ubuntu Linux* PC. Similar functionality can be implemented with a Windows* or macOS* connection.
- Connect a micro-USB cable from the module to the PC for UART connection (if not already connected).
- From the PC terminal open a UART shell (e.g., “picocom -b 115200 /dev/ttyUSB0”).
- In the UART shell (or the module terminal directly) type “ifconfig” and note down the IP address ("inet addr") of the usb0 connection.
|Note: This will likely have been pre-configured in the Ref-OS-IoT image to be "169.254.2.2" but should still be checked|
- Now connect a USB Type-C cable from the module to the PC for SSH connection.
- The Ubuntu* PC will automatically recognize a new wired connection (e.g. "Wired connection 2")
- From the PC go to System Settings... > Network, choose the new Wired connection and choose the "Options..." button to edit it
On the Wired tab, click Add to create a new connection configuration. Give the connection a name. In the Device MAC address field, select the usb0 connection.
On the IPv4 Settings tab, set "Method" to be "Manual"
Under the "Addresses" field choose "Add" give it an IP address that is on the same sub network but not the same as the development board showed when running ifconfig. For the default module IP address of "169.254.2.2" change the last digit from 2 to 3.
Set the netmask to 255.255.255.0 and the Gateway to 0.0.0.0.
On the same tab, press the Routes button and tick the “Use this connection only for resources on its network”
Save the connection settings and close the Network Connections window
- Open a terminal on the PC and run “ifconfig”. You should now see an IP address for the usb0 connection
- On the module edit the file /etc/ssh/sshd_config and either add or uncomment the line “PermitRootLogin yes”
- The module cannot be accessed as root user from the host unless a password has been set. If one doesn’t already exist then set this from the client command-line using “passwd” to set a new one
- From the PC type “ssh firstname.lastname@example.org” and enter the password when requested to make an ssh connection to the development board
The connection should now be complete and allow a simple file transfer between host and client. An example would be:
scp file.txt email@example.com:.