Reputation: 969
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?
Upvotes: 0
Views: 3155
Reputation: 26016
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
Upvotes: 1
Reputation: 11092
Port argument should be passed with -P not -p
Try this
scp -p root@serverIP:/dir_path/ /local_path/ -P 3031
-p is for preserving modification and access times and modes of the original file
If you got the ssh key then try this
scp -i path/to/file.pem -p root@serverIP:/dir_path/ /local_path/ -P 3031
Upvotes: 1