SFTP Server
SFTP (Secure File Transfer Protocol) can be used to transfer files like binaries, device tree blobs or config files between a host PC and a target board.
Preface
To transfer data via SFTP, the sftp command is necessary on the host PC. In most cases, it is preinstalled on Windows and Linux.
Make sure SSH is installed on the board (e.g. in /usr/bin/sshd, /usr/bin/ssh)
Set up the connection
For SFTP to work, both the Host PC and the board need to be connected via Ethernet and their IP Addresses must be in the same subnet.
ip addr add <ip_in_same_subnet>/24 dev <connected_interface> # e.g. set ip address on a board to match a host with the ip 192.168.10.10 ip addr add 192.168.10.11/24 dev end0
To ensure the connection works, the host PC can ping the board using ping <ip-address> and vice versa.
Transfer data
Open a terminal on the host PC and open the sftp connection.
sftp username@ip-address # e.g. sftp root@192.168.10.11
In the interactive command mode, it is possible to send and receive files or list content of the current directory on the board or the host.
Send files from the host to the board:
put <filename> # or put <filename> <destination>
Get files from the board:
get <filename>
List files in the boards current working directory:
ls
List files in the hosts current working directory:
lls
Exit the SFTP interactive mode:
exit