Pk19000 Pk19000 - 1 month ago 11
Linux Question

Error when download a file from server using scp

I wanna to download some files and directory from server using

scp
.

scp -p 3031 root@serverIP -D 1080:/dir_path/. /local_path/


But with this command I get some error:


cp: cannot stat '3031': No such file or directory

cp: cannot stat 'root@serverIP': No such file or directory

cp: cannot stat '-D': No such file or directory

ssh: connect to host 1080 port 22: Invalid argument


Can anybody help me please?

Answer

The switches have their meaning and their order matters. The correct path (assuming you want to download a file) would be:

scp -P 3031 root@serverIP:/dir_path/file /local_path/

Synopsis in the manual page for scp should be your friend:

SYNOPSIS

scp [-12346BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file] [-l limit] [-o ssh_option] [-P port] [-S program] [[user@]host1:]file1 ... [[user@]host2:]file2