我正在尝试通过 shh 连接将数据复制到远程服务器。
我收到以下错误:
[localhost]: scp: illegal option -- 0
[localhost]: usage: scp [-12346BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file]
[localhost]: [-l limit] [-o ssh_option] [-P port] [-S program]
[localhost]: [[user@]host1:]file1 ... [[user@]host2:]file2
Run Code Online (Sandbox Code Playgroud)
我使用的脚本执行此请求:
scp -p10012 /Users/trst/Docs/repositories/pro/.envoydeploy/tmp/servers/172.12.11.150 admin@172.12.11.150:/var/www/pro/tmp/service_owner
Run Code Online (Sandbox Code Playgroud)
scp中设置端口的开关是大写的 -P
-P port
Specifies the port to connect to on the remote host. Note that
this option is written with a capital ‘P’, because -p is already
reserved for preserving the times and modes of the file in
rcp(1).
-p Preserves modification times, access times, and modes from the
original file.
Run Code Online (Sandbox Code Playgroud)
小写-p
不带参数,因此10012
被视为进一步的选项序列;options-1
并且-2
是有效的选项(控制 SSH 协议)但-0
不是 - 因此错误。