scp: 無効なオプション - 0 [閉じる]

scp: 無効なオプション - 0 [閉じる]

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

私が使用するスクリプトは、次の要求を実行します。

 scp -p10012 /Users/trst/Docs/repositories/pro/.envoydeploy/tmp/servers/172.12.11.150 [email protected]:/var/www/pro/tmp/service_owner

ベストアンサー1

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.

小文字は-p引数を使用しないため、追加の10012オプションシーケンスとして扱われ、有効なオプション(SSHプロトコル制御)ですが、そうでないため-1エラーが発生します。-2-0

おすすめ記事