Linux - Scp, download directory from server to local, using ssh
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
It's probably a silly thing, but I am trying to download a directory from my cloud server to my local, using scp
, with the following:
scp -i ./.ssh/mykey.pem -r -p admin@11.11.251.205:/var/lib/mongodb 127.0.0.1:/var/lib/mongod
admin
is of course the remote, for which I need to key, while 127.0.0.1 is the local.
I receive however the error message:
Host key verification failed.
lost connection
If I try to connect through ssh to my server using ssh -i ./.ssh/mykey.pem admin@11.11.251.205
it does work.
Could anyone point me to what I am doing wrong?
linux scp
add a comment |Â
up vote
0
down vote
favorite
It's probably a silly thing, but I am trying to download a directory from my cloud server to my local, using scp
, with the following:
scp -i ./.ssh/mykey.pem -r -p admin@11.11.251.205:/var/lib/mongodb 127.0.0.1:/var/lib/mongod
admin
is of course the remote, for which I need to key, while 127.0.0.1 is the local.
I receive however the error message:
Host key verification failed.
lost connection
If I try to connect through ssh to my server using ssh -i ./.ssh/mykey.pem admin@11.11.251.205
it does work.
Could anyone point me to what I am doing wrong?
linux scp
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
It's probably a silly thing, but I am trying to download a directory from my cloud server to my local, using scp
, with the following:
scp -i ./.ssh/mykey.pem -r -p admin@11.11.251.205:/var/lib/mongodb 127.0.0.1:/var/lib/mongod
admin
is of course the remote, for which I need to key, while 127.0.0.1 is the local.
I receive however the error message:
Host key verification failed.
lost connection
If I try to connect through ssh to my server using ssh -i ./.ssh/mykey.pem admin@11.11.251.205
it does work.
Could anyone point me to what I am doing wrong?
linux scp
It's probably a silly thing, but I am trying to download a directory from my cloud server to my local, using scp
, with the following:
scp -i ./.ssh/mykey.pem -r -p admin@11.11.251.205:/var/lib/mongodb 127.0.0.1:/var/lib/mongod
admin
is of course the remote, for which I need to key, while 127.0.0.1 is the local.
I receive however the error message:
Host key verification failed.
lost connection
If I try to connect through ssh to my server using ssh -i ./.ssh/mykey.pem admin@11.11.251.205
it does work.
Could anyone point me to what I am doing wrong?
linux scp
edited Jan 31 at 1:11
muru
33.5k577143
33.5k577143
asked Jan 31 at 1:07
jim basquiat
1417
1417
add a comment |Â
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
2
down vote
accepted
For copying to the local server, you don't need the 127.0.0.1:
. Just this will do:
scp -i ./.ssh/mykey.pem -r -p admin@11.11.251.205:/var/lib/mongodb /var/lib/mongod
With the 127.0.0.1:
, scp makes another SSH connection to the server at 127.0.0.1 and acts as if it was copying between two remotes. The SSH server at 127.0.0.1 might be failing host key verification.
add a comment |Â
up vote
1
down vote
From Man page,
scp [-346BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file] [-l limit] [-o ssh_option] [-P port] [-S program] [[
user@]host1
:]file1 ... [[user@]host2
:]file2
So when you are using 127.0.0.1
at last portion, scp
recognized that as host2
. So then scp
will try to logged in at 127.0.0.1
host with current username
, based on the identity file (./.ssh/mykey.pem
) and returns error, may be because there is no information about host2
. So just following will work fine,
$scp -i ./.ssh/mykey.pem -r -p admin@11.11.251.205:/var/lib/mongodb /var/lib/mongodb
OR
$cd /var/lib/mongodb
$scp -i ./.ssh/mykey.pem -r -p admin@11.11.251.205:/var/lib/mongodb .
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
accepted
For copying to the local server, you don't need the 127.0.0.1:
. Just this will do:
scp -i ./.ssh/mykey.pem -r -p admin@11.11.251.205:/var/lib/mongodb /var/lib/mongod
With the 127.0.0.1:
, scp makes another SSH connection to the server at 127.0.0.1 and acts as if it was copying between two remotes. The SSH server at 127.0.0.1 might be failing host key verification.
add a comment |Â
up vote
2
down vote
accepted
For copying to the local server, you don't need the 127.0.0.1:
. Just this will do:
scp -i ./.ssh/mykey.pem -r -p admin@11.11.251.205:/var/lib/mongodb /var/lib/mongod
With the 127.0.0.1:
, scp makes another SSH connection to the server at 127.0.0.1 and acts as if it was copying between two remotes. The SSH server at 127.0.0.1 might be failing host key verification.
add a comment |Â
up vote
2
down vote
accepted
up vote
2
down vote
accepted
For copying to the local server, you don't need the 127.0.0.1:
. Just this will do:
scp -i ./.ssh/mykey.pem -r -p admin@11.11.251.205:/var/lib/mongodb /var/lib/mongod
With the 127.0.0.1:
, scp makes another SSH connection to the server at 127.0.0.1 and acts as if it was copying between two remotes. The SSH server at 127.0.0.1 might be failing host key verification.
For copying to the local server, you don't need the 127.0.0.1:
. Just this will do:
scp -i ./.ssh/mykey.pem -r -p admin@11.11.251.205:/var/lib/mongodb /var/lib/mongod
With the 127.0.0.1:
, scp makes another SSH connection to the server at 127.0.0.1 and acts as if it was copying between two remotes. The SSH server at 127.0.0.1 might be failing host key verification.
edited Jan 31 at 1:20
answered Jan 31 at 1:14
muru
33.5k577143
33.5k577143
add a comment |Â
add a comment |Â
up vote
1
down vote
From Man page,
scp [-346BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file] [-l limit] [-o ssh_option] [-P port] [-S program] [[
user@]host1
:]file1 ... [[user@]host2
:]file2
So when you are using 127.0.0.1
at last portion, scp
recognized that as host2
. So then scp
will try to logged in at 127.0.0.1
host with current username
, based on the identity file (./.ssh/mykey.pem
) and returns error, may be because there is no information about host2
. So just following will work fine,
$scp -i ./.ssh/mykey.pem -r -p admin@11.11.251.205:/var/lib/mongodb /var/lib/mongodb
OR
$cd /var/lib/mongodb
$scp -i ./.ssh/mykey.pem -r -p admin@11.11.251.205:/var/lib/mongodb .
add a comment |Â
up vote
1
down vote
From Man page,
scp [-346BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file] [-l limit] [-o ssh_option] [-P port] [-S program] [[
user@]host1
:]file1 ... [[user@]host2
:]file2
So when you are using 127.0.0.1
at last portion, scp
recognized that as host2
. So then scp
will try to logged in at 127.0.0.1
host with current username
, based on the identity file (./.ssh/mykey.pem
) and returns error, may be because there is no information about host2
. So just following will work fine,
$scp -i ./.ssh/mykey.pem -r -p admin@11.11.251.205:/var/lib/mongodb /var/lib/mongodb
OR
$cd /var/lib/mongodb
$scp -i ./.ssh/mykey.pem -r -p admin@11.11.251.205:/var/lib/mongodb .
add a comment |Â
up vote
1
down vote
up vote
1
down vote
From Man page,
scp [-346BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file] [-l limit] [-o ssh_option] [-P port] [-S program] [[
user@]host1
:]file1 ... [[user@]host2
:]file2
So when you are using 127.0.0.1
at last portion, scp
recognized that as host2
. So then scp
will try to logged in at 127.0.0.1
host with current username
, based on the identity file (./.ssh/mykey.pem
) and returns error, may be because there is no information about host2
. So just following will work fine,
$scp -i ./.ssh/mykey.pem -r -p admin@11.11.251.205:/var/lib/mongodb /var/lib/mongodb
OR
$cd /var/lib/mongodb
$scp -i ./.ssh/mykey.pem -r -p admin@11.11.251.205:/var/lib/mongodb .
From Man page,
scp [-346BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file] [-l limit] [-o ssh_option] [-P port] [-S program] [[
user@]host1
:]file1 ... [[user@]host2
:]file2
So when you are using 127.0.0.1
at last portion, scp
recognized that as host2
. So then scp
will try to logged in at 127.0.0.1
host with current username
, based on the identity file (./.ssh/mykey.pem
) and returns error, may be because there is no information about host2
. So just following will work fine,
$scp -i ./.ssh/mykey.pem -r -p admin@11.11.251.205:/var/lib/mongodb /var/lib/mongodb
OR
$cd /var/lib/mongodb
$scp -i ./.ssh/mykey.pem -r -p admin@11.11.251.205:/var/lib/mongodb .
edited Jan 31 at 1:26
answered Jan 31 at 1:19
muhammad
480414
480414
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f420837%2flinux-scp-download-directory-from-server-to-local-using-ssh%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password