SCP HowTo
About
SCP (Secure Copy Protocol) is a method for copying files from one device to another over a public network without anyone being able to eavesdrop on the contents. This works by using an SSH connection to initiate and carry out the file transfer.
WeOS supports use of SCP for installation or back-up of files to the following file system paths:
-
/cfg/ for configuration files. Files in this directory are reachable from WeOS CLI using the cfg:// prefix. It is also the default target directory for the
copy
,dir
, andshow
commands. These files are stored in flash memory and will survive a restart. -
/crt/ for certificates and key files. Files in this directory are reachable from the WeOS CLI using the crt:// prefix. These files are stored in flash memory and will survive a restart.
-
/log/ for log files. Files in this directory are reachable from the WeOS CLI using the log:// prefix in WeOS CLI. These files are stored in RAM and will disappear when the device is restarted.
-
It is also possible to SCP files to other destination directories on the WeOS device, but then they will only be accessible from the WeOS Linux shell and care must be taken not to overwrite important system files. Such use of SCP is not supported.
For SCP to work, the SSH service must be active on the remote device. If the SSH service is using a non-standard port, the port number has to be specified in the scp command.
Initiating SCP from a Unix host
Here is an example of copying a configuration file named safe.cfg onto the WeOS device, where it is stored as /cfg/config9.cfg.
foo@localhost$ *scp safe.cfg admin@192.168.122.89:/cfg/config9.cfg*
Here is an example of retrieving the main log file messages
from
the WeOS device and storing it as msg-save on the local host.
foo@localhost$ *scp admin@192.168.122.89:/log/messages msg-save
Initiating SCP from a WeOS device
These examples are equivalent to those in the previous section, but they
are initiated from the WeOS CLI instead of from the Unix command line.
The syntax is a little bit different. In WeOS you must use the copy
command with the scp://
prefix to designate an SCP transfer.
In the first example, the cfg:// qualifier can be omitted from the destination path as it is the default.
copy scp://foo@192.168.122.1/home/foo/safe.cfg config9
In the second example, you have to specify the ‘log://’ prefix for the source file.
copy log://messages scp://foo@192.168.122.1/home/foo/msg-save
For further details regarding syntax and restrictions, see the
CLI help for the copy
command: help copy