Difference between revisions of "How to transfer a file over network"

[quality revision] [quality revision]
m
m

Template:ReviewersList Template:ArticleApprovedVersion

1 Article purpose[edit]

The article aims to give some information useful to start with the scp Linux command.

2 Introduction[edit]

The scp[1] copies files between hosts on a network. It uses ssh[2] (remote login program) for data transfer, uses the same authentication and provides the same security as ssh.

This article focuses on the file transfer between a host PC and a STMicroelectronics board over a network connection.

3 Installation on your target[edit]

The scp is installed on the STMicroelectronics images via the package openssh.

4 Installation on your PC[edit]

The package openssh-client must be installed on your host PC to perform a file transfer over network with the scp.

On Ubuntu:

PC $> sudo apt-get install openssh-client

5 Getting started[edit]

  • Your host PC and your board are connected to your local network through
  • Upload a file (<host file path>/<example.txt>) from your host PC to your board:
PC $> scp <host file path>/<example.txt> root@<board ip address>:/<board file path>/
Example (assuming that <board ip address> is a.b.c.d):
 Copy the example.txt host PC file in the /home/root/ board directory
 PC $> echo "scp example: from host PC to board" > ./example.txt
 PC $> scp ./example.txt root@a.b.c.d:/home/root

 Check the result on the board 
 Board $> cat /home/root/example.txt 
 scp example
  • Download a file (/<board file path>/<example.txt>) from your board to your host PC:
PC $> scp root@<board ip address>:/<board file path>/<example.txt> <host file path>/
Example (assuming that <board ip address> is a.b.c.d):
 Copy the example.txt board file in the current directory of the host PC
 Board $> echo "scp example: from board to host PC" > /home/root/example.txt
 PC $> scp root@a.b.c.d:/home/root/example.txt ./

 Check the result on the host PC
 Board $> cat ./example.txt
 scp example: from board to host PC

6 References[edit]


<noinclude>

{{ReviewersList | BernardP, ChristopheP, SebastienG}}  
{{ArticleApprovedVersion | Jean-ChristopheT | BernardP, ChristopheP | No previous approved version | AlainF - 03Jul'18 - 7893 | 05Jul'18}} 
[[Category:How to run use cases]]
[[Category:How to populate boards]]</noinclude>

==Article purpose==
The article aims to give some information useful to start with the '''''scp''''' Linux command.

==Introduction==
The ''scp''<ref>[https://linux.die.net/man/1/scp scp - Linux man page]</ref> copies files between hosts on a network. It uses ''ssh''<ref>[https://linux.die.net/man/1/ssh ssh - Linux man page]</ref> (remote login program) for data transfer, uses the same authentication and provides the same security as ''ssh''.

This article focuses on the file transfer between a host PC and a STMicroelectronics board over a network connection.

==Installation on your target==
The ''scp'' is installed on the STMicroelectronics images via the package '''openssh'''.

==Installation on your PC==
The package '''openssh-client''' must be installed on your host PC to perform a file transfer over network with the ''scp''.

On Ubuntu:
 {{PC$}} sudo apt-get install openssh-client

==Getting started ==
* Your host PC and your board are connected to your local network through {{UpdateNeededForNewBoard|Point to the Ethernet connector (if any) of the new board}}
:* the [[STM32MP157C-EV1 - hardware description#MB1262-CN3|STM32MP157C-EV1 Evaluation board CN3 Ethernet connector]]
:* the [[STM32MP157X-DKX - hardware_description#MB1272-CN8|STM32MP157X-DKX Discovery kit CN8 Ethernet connector]]

* The board IP address (''<board ip address>'') has been retrieved thanks to the [[IP Linux command line|''ip'' Linux command line]]

* <span id="Copy a file over network"></span>'''Upload a file''' (''<host file path>/<example.txt>'') '''from your host PC to your board:''' 
 {{PC$}} scp <host file path>/<example.txt> root@<board ip address>:/<board file path>/

 Example (assuming that ''<board ip address>'' is ''a.b.c.d''):
  Copy the ''example.txt'' host PC file in the ''/home/root/'' board directory
  {{PC$}} echo "scp example: from host PC to board" > ./example.txt
  {{PC$}} scp ./example.txt root@a.b.c.d:/home/root

  Check the result on the board 
  {{Board$}} cat /home/root/example.txt 
  scp example

* Download a file (''/<board file path>/<example.txt>'') from your board to your host PC:
 {{PC$}} scp root@<board ip address>:/<board file path>/<example.txt> <host file path>/

 Example (assuming that ''<board ip address>'' is ''a.b.c.d''):
  Copy the ''example.txt'' board file in the current directory of the host PC
  {{Board$}} echo "scp example: from board to host PC" > /home/root/example.txt
  {{PC$}} scp root@a.b.c.d:/home/root/example.txt ./

  Check the result on the host PC
  {{Board$}} cat ./example.txt
  scp example: from board to host PC

==References==
<references />

<noinclude>

[[Category:How to run use cases]]
[[Category:How to populate boards]]
{{PublicationRequestId | 7893 | 2018-07-03 | AlainF}}</noinclude>
Line 1: Line 1:
<noinclude>
 
{{ReviewersList | BernardP, ChristopheP, SebastienG}} 
 
{{ArticleApprovedVersion | Jean-ChristopheT | BernardP, ChristopheP | No previous approved version | AlainF - 03Jul'18 - 7893 | 05Jul'18}}
 
[[Category:How to run use cases]]
 
[[Category:How to populate boards]]
 
</noinclude>
 
 
 
==Article purpose==
 
==Article purpose==
 
The article aims to give some information useful to start with the '''''scp''''' Linux command.
 
The article aims to give some information useful to start with the '''''scp''''' Linux command.
Line 57: Line 50:
   
 
<references />
 
<references />
  +
  +
<noinclude>
  +
[[Category:How to run use cases]]
  +
[[Category:How to populate boards]]
  +
{{PublicationRequestId | 7893 | 2018-07-03 | AlainF}}
  +
</noinclude>

Attachments

Discussions