emscli execute sftp
copies files to/from a remote host using the SFTP service
|
|
For security reasons, you cannot freely transfer files from other hosts to EMS Virtual Appliance host using "scp", "ftp", or "sftp". You can only transfer files to/from an EMS Virtual Appliance by running the relevant commands from the EMS Virtual Appliance itself. |
Synopsis
execute sftp attempts to copy files to or from a remote host using the SFTP service.
If copying from a remote host to the local machine, include the --read flag; if copying from the local machine to a remote host, do not include the flag.
Also include:
- the local filepath (or local destination for a remote file) to the
--local.fileflag; - the remote filepath (or remote destination for a local file) to the
--remote.fileflag, and - any other --remote flags required to connect.
emscli execute sftp [flags]
Options
-h, --help help for sftp
--local.file string The /path/filename of the file to be copied (or destination of the file to be saved) on the local host. If no path is specified, the command will look for the file in the "/exchange" folder.
--read Specifies that this command is to read a file from the remote host (rather than copy from)
--remote.file string The /path/filename of the file to be copied (or destination of the file to be saved) on the remote host. The remote filename on the target host can be different from the filename on your EMS Virtual Appliance. Examples: --remote.file "c:/workfolder/file20.txt" or --remote.file "/home/myuser/file20.txt"
--remote.ip string The IP of the remote host where the file will be copied to/from
--remote.password string The password for the remote user that will be used to connect to the remote host. If the password is not provided here, you will be prompted to enter the password when running the command.
--remote.port int If your SFTP client is configured to use a different port than port 22, use the --remote.port option to specify the port. For example, --remote.port 3022
--remote.user string The user that will be used to connect to the remote host. The user must have write or read permission to folder on the remote host, depending on whether you are writing to or reading from the remote host.
Examples
-
To transfer a file from the EMS Virtual Appliance to a Windows host (with SFTP client service installed):
emscli execute sftp --remote.ip 172.10.10.10 --remote.user myuser --remote.file "c:/workfolder/file20.txt" --local.file file10.txt
-
To transfer a file (such as hotfix files from Fortinet support or public keys for migration from 7.2) from a Linux host (with SFTP client service installed) to the EMS Virtual Appliance:
emscli execute sftp --read --remote.ip 172.10.10.10 --remote.user myuser --remote.file "/home/myuser/file30.txt" --local.file file40.txt
To collect EMS log and configuration files for troubleshooting, use the emscli execute diagnostic command instead.
See also
- emscli execute - for executing commands on the host
- emscli execute scp - copies files to/from a remote host using the SCP service
- emscli execute ftp - copies files to/from a remote host using the FTP service