scp error: “Permission denied (publickey). lost connection”
I tried to scp an svn dump to savannah, but I got the following error at the end.
Permission denied (publickey).
lost connection
The scp command and verbose output are below. Any ideas?
[wcyang@be2-wireless-pittnet-60-37 ~]$ scp -v diffcolor-dump.bz2 wcyang@dl.sv.gnu.org:/srv/download/diffcolor/
Executing: program /usr/bin/ssh host dl.sv.gnu.org, user wcyang, command scp -v -t /srv/download/diffcolor/
OpenSSH_5.2p1, OpenSSL 0.9.7l 28 Sep 2006
debug1: Reading configuration data /etc/ssh_config
debug1: Connecting to dl.sv.gnu.org [140.186.70.73] port 22.
debug1: Connection established.
debug1: identity file /Users/wcyang/.ssh/identity type -1
debug1: identity file /Users/wcyang/.ssh/id_rsa type 1
debug1: identity file /Users/wcyang/.ssh/id_dsa type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.1p1 Debian-5
debug1: match: OpenSSH_5.1p1 Debian-5 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.2
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host 'dl.sv.gnu.org' is known and matches the RSA host key.
debug1: Found key in /Users/wcyang/.ssh/known_hosts:1
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /Users/wcyang/.ssh/identity
debug1: Offering public key: /Users/wcyang/.ssh/id_rsa
debug1: Authentications that can continue: publickey
debug1: Trying private key: /Users/wcyang/.ssh/id_dsa
debug1: No more authentication methods to try.
Permission denied (publickey).
lost connection
unix scp
migrated from stackoverflow.com Jan 13 '10 at 3:49
This question came from our site for professional and enthusiast programmers.
add a comment |
I tried to scp an svn dump to savannah, but I got the following error at the end.
Permission denied (publickey).
lost connection
The scp command and verbose output are below. Any ideas?
[wcyang@be2-wireless-pittnet-60-37 ~]$ scp -v diffcolor-dump.bz2 wcyang@dl.sv.gnu.org:/srv/download/diffcolor/
Executing: program /usr/bin/ssh host dl.sv.gnu.org, user wcyang, command scp -v -t /srv/download/diffcolor/
OpenSSH_5.2p1, OpenSSL 0.9.7l 28 Sep 2006
debug1: Reading configuration data /etc/ssh_config
debug1: Connecting to dl.sv.gnu.org [140.186.70.73] port 22.
debug1: Connection established.
debug1: identity file /Users/wcyang/.ssh/identity type -1
debug1: identity file /Users/wcyang/.ssh/id_rsa type 1
debug1: identity file /Users/wcyang/.ssh/id_dsa type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.1p1 Debian-5
debug1: match: OpenSSH_5.1p1 Debian-5 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.2
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host 'dl.sv.gnu.org' is known and matches the RSA host key.
debug1: Found key in /Users/wcyang/.ssh/known_hosts:1
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /Users/wcyang/.ssh/identity
debug1: Offering public key: /Users/wcyang/.ssh/id_rsa
debug1: Authentications that can continue: publickey
debug1: Trying private key: /Users/wcyang/.ssh/id_dsa
debug1: No more authentication methods to try.
Permission denied (publickey).
lost connection
unix scp
migrated from stackoverflow.com Jan 13 '10 at 3:49
This question came from our site for professional and enthusiast programmers.
might get a better response on superuser.com
– Brian
Jan 13 '10 at 3:44
Have you uploaded a public key to authenticate with? Is it the one matching the private key in ~/.ssh ?
– sth
Jan 13 '10 at 3:45
Use more v's -- scp -vv or -vvv should give even more verbose log messages.
– Jim Lewis
Jan 13 '10 at 3:53
Also, disregard any advice to post all the files under your .ssh directory so we can check them for typos.
– Jim Lewis
Jan 13 '10 at 3:53
add a comment |
I tried to scp an svn dump to savannah, but I got the following error at the end.
Permission denied (publickey).
lost connection
The scp command and verbose output are below. Any ideas?
[wcyang@be2-wireless-pittnet-60-37 ~]$ scp -v diffcolor-dump.bz2 wcyang@dl.sv.gnu.org:/srv/download/diffcolor/
Executing: program /usr/bin/ssh host dl.sv.gnu.org, user wcyang, command scp -v -t /srv/download/diffcolor/
OpenSSH_5.2p1, OpenSSL 0.9.7l 28 Sep 2006
debug1: Reading configuration data /etc/ssh_config
debug1: Connecting to dl.sv.gnu.org [140.186.70.73] port 22.
debug1: Connection established.
debug1: identity file /Users/wcyang/.ssh/identity type -1
debug1: identity file /Users/wcyang/.ssh/id_rsa type 1
debug1: identity file /Users/wcyang/.ssh/id_dsa type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.1p1 Debian-5
debug1: match: OpenSSH_5.1p1 Debian-5 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.2
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host 'dl.sv.gnu.org' is known and matches the RSA host key.
debug1: Found key in /Users/wcyang/.ssh/known_hosts:1
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /Users/wcyang/.ssh/identity
debug1: Offering public key: /Users/wcyang/.ssh/id_rsa
debug1: Authentications that can continue: publickey
debug1: Trying private key: /Users/wcyang/.ssh/id_dsa
debug1: No more authentication methods to try.
Permission denied (publickey).
lost connection
unix scp
I tried to scp an svn dump to savannah, but I got the following error at the end.
Permission denied (publickey).
lost connection
The scp command and verbose output are below. Any ideas?
[wcyang@be2-wireless-pittnet-60-37 ~]$ scp -v diffcolor-dump.bz2 wcyang@dl.sv.gnu.org:/srv/download/diffcolor/
Executing: program /usr/bin/ssh host dl.sv.gnu.org, user wcyang, command scp -v -t /srv/download/diffcolor/
OpenSSH_5.2p1, OpenSSL 0.9.7l 28 Sep 2006
debug1: Reading configuration data /etc/ssh_config
debug1: Connecting to dl.sv.gnu.org [140.186.70.73] port 22.
debug1: Connection established.
debug1: identity file /Users/wcyang/.ssh/identity type -1
debug1: identity file /Users/wcyang/.ssh/id_rsa type 1
debug1: identity file /Users/wcyang/.ssh/id_dsa type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.1p1 Debian-5
debug1: match: OpenSSH_5.1p1 Debian-5 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.2
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host 'dl.sv.gnu.org' is known and matches the RSA host key.
debug1: Found key in /Users/wcyang/.ssh/known_hosts:1
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /Users/wcyang/.ssh/identity
debug1: Offering public key: /Users/wcyang/.ssh/id_rsa
debug1: Authentications that can continue: publickey
debug1: Trying private key: /Users/wcyang/.ssh/id_dsa
debug1: No more authentication methods to try.
Permission denied (publickey).
lost connection
unix scp
unix scp
asked Jan 13 '10 at 3:34
wcyang
128115
128115
migrated from stackoverflow.com Jan 13 '10 at 3:49
This question came from our site for professional and enthusiast programmers.
migrated from stackoverflow.com Jan 13 '10 at 3:49
This question came from our site for professional and enthusiast programmers.
might get a better response on superuser.com
– Brian
Jan 13 '10 at 3:44
Have you uploaded a public key to authenticate with? Is it the one matching the private key in ~/.ssh ?
– sth
Jan 13 '10 at 3:45
Use more v's -- scp -vv or -vvv should give even more verbose log messages.
– Jim Lewis
Jan 13 '10 at 3:53
Also, disregard any advice to post all the files under your .ssh directory so we can check them for typos.
– Jim Lewis
Jan 13 '10 at 3:53
add a comment |
might get a better response on superuser.com
– Brian
Jan 13 '10 at 3:44
Have you uploaded a public key to authenticate with? Is it the one matching the private key in ~/.ssh ?
– sth
Jan 13 '10 at 3:45
Use more v's -- scp -vv or -vvv should give even more verbose log messages.
– Jim Lewis
Jan 13 '10 at 3:53
Also, disregard any advice to post all the files under your .ssh directory so we can check them for typos.
– Jim Lewis
Jan 13 '10 at 3:53
might get a better response on superuser.com
– Brian
Jan 13 '10 at 3:44
might get a better response on superuser.com
– Brian
Jan 13 '10 at 3:44
Have you uploaded a public key to authenticate with? Is it the one matching the private key in ~/.ssh ?
– sth
Jan 13 '10 at 3:45
Have you uploaded a public key to authenticate with? Is it the one matching the private key in ~/.ssh ?
– sth
Jan 13 '10 at 3:45
Use more v's -- scp -vv or -vvv should give even more verbose log messages.
– Jim Lewis
Jan 13 '10 at 3:53
Use more v's -- scp -vv or -vvv should give even more verbose log messages.
– Jim Lewis
Jan 13 '10 at 3:53
Also, disregard any advice to post all the files under your .ssh directory so we can check them for typos.
– Jim Lewis
Jan 13 '10 at 3:53
Also, disregard any advice to post all the files under your .ssh directory so we can check them for typos.
– Jim Lewis
Jan 13 '10 at 3:53
add a comment |
3 Answers
3
active
oldest
votes
Did you expect to be prompted for a password? If so, then something in your ssh or the remote server's sshd configuration's changed to disallow password authentication.
Otherwise, your debug output seems to be saying that your private keys don't match any of the public keys in the remote account's .ssh directory. Have you compared the ~/.ssh/id_?sa.pub
files on savannah to the output from ssh-keygen -y
on your local box?
Another possibility is that the permissions on your .ssh files are too permissive. I believe I've seen that happen without any output, debug or otherwise, to hint at it.
add a comment |
This is a authentication error
, there is not a matching key
to pair to.
When having problems with ssh
or using ssh
over scp
as your doing the -v switch is very informative to diagnose the problem, the more v
's you put in there the more verbose
the output:
scp -vvv -P 30000 /somedir/somedir/file user@domain:/somedir/somedir/
Here is a sample output of it:
OpenSSH_6.7p1 Debian-5+deb8u7, OpenSSL 1.0.1t 3 May 2016
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to 192.168.1.171 [192.168.1.171] port 30000.
debug1: Connection established.
debug1: permanently_set_uid: 0/0
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/identity type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/identity-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_rsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ed25519-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.4p1 Debian-10+deb9u4
debug1: match: OpenSSH_7.4p1 Debian-10+deb9u4 pat OpenSSH* compat 0x04000000
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.7p1 Debian-5+deb8u7
debug2: fd 3 setting O_NONBLOCK
debug3: put_host_port: [192.168.1.171]:30000
debug3: load_hostkeys: loading entries for host "[192.168.1.171]:30000" from file "/root/.ssh/known_hosts"
debug3: load_hostkeys: found key type ECDSA in file /root/.ssh/known_hosts:7
debug3: load_hostkeys: loaded 1 keys
debug3: order_hostkeyalgs: prefer hostkeyalgs: ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
You could check if the permissions
on the ssh
files are rightly set, you can see the right permissions
below in my ls
command
There maybe is someone who deleted your key
from the server.
Or as in the comments someone said, maybe you don't have a matching private key
?
To create a ssh key
if anyone needs that at this stage, this is how you do that:
ssh-keygen -o -b 4096 -t rsa -C your-email@gmail.com
that creates a private key
and a public key
in ~/.ssh/
directory, be careful never to share your private key, that's the id_rsa
....notice that ~/.ssh/
has a dot in front of it because it's a hidden directory like here:
$ls -sail .ssh/
total 20
658 4 drwx------ 2 user user 4096 Nov 10 06:05 .
12 4 drwxr-xr-x 47 user user 4096 Nov 10 06:11 ..
34211 4 -rw-r--r-- 1 user user 1487 Nov 1 02:37 authorized_keys
34375 4 -rw------- 1 user user 3434 Nov 10 06:05 id_rsa
34376 4 -rw-r--r-- 1 user user 749 Nov 10 06:05 id_rsa.pub
664 0 -rw-r--r-- 1 user user 0 Nov 10 06:04 known_hosts
then to copy the key over to the server:
cat ~/.ssh/id_rsa.pub | ssh -p 30000 something@SERVER 'cat >> .ssh/authorized_keys'
You need to get your public
ssh
key
to the server and if you don't have access to it in physical and can edit sshd_config
to allow passwords
# Change to no to disable tunnelled clear text passwords
PasswordAuthentication no
while you copy it, you could email
it to the system administrator
and he can put it on the server.
add a comment |
This solved it for me:
ssh-keygen -f "/home/local/.../.ssh/known_hosts" -R
1
Can you explain those switches please?
– Fazer87
Apr 24 '15 at 7:00
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
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
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f95171%2fscp-error-permission-denied-publickey-lost-connection%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
Did you expect to be prompted for a password? If so, then something in your ssh or the remote server's sshd configuration's changed to disallow password authentication.
Otherwise, your debug output seems to be saying that your private keys don't match any of the public keys in the remote account's .ssh directory. Have you compared the ~/.ssh/id_?sa.pub
files on savannah to the output from ssh-keygen -y
on your local box?
Another possibility is that the permissions on your .ssh files are too permissive. I believe I've seen that happen without any output, debug or otherwise, to hint at it.
add a comment |
Did you expect to be prompted for a password? If so, then something in your ssh or the remote server's sshd configuration's changed to disallow password authentication.
Otherwise, your debug output seems to be saying that your private keys don't match any of the public keys in the remote account's .ssh directory. Have you compared the ~/.ssh/id_?sa.pub
files on savannah to the output from ssh-keygen -y
on your local box?
Another possibility is that the permissions on your .ssh files are too permissive. I believe I've seen that happen without any output, debug or otherwise, to hint at it.
add a comment |
Did you expect to be prompted for a password? If so, then something in your ssh or the remote server's sshd configuration's changed to disallow password authentication.
Otherwise, your debug output seems to be saying that your private keys don't match any of the public keys in the remote account's .ssh directory. Have you compared the ~/.ssh/id_?sa.pub
files on savannah to the output from ssh-keygen -y
on your local box?
Another possibility is that the permissions on your .ssh files are too permissive. I believe I've seen that happen without any output, debug or otherwise, to hint at it.
Did you expect to be prompted for a password? If so, then something in your ssh or the remote server's sshd configuration's changed to disallow password authentication.
Otherwise, your debug output seems to be saying that your private keys don't match any of the public keys in the remote account's .ssh directory. Have you compared the ~/.ssh/id_?sa.pub
files on savannah to the output from ssh-keygen -y
on your local box?
Another possibility is that the permissions on your .ssh files are too permissive. I believe I've seen that happen without any output, debug or otherwise, to hint at it.
edited Jul 8 '11 at 14:09
n0pe
8,332165998
8,332165998
answered Jan 17 '10 at 7:00
pra
19317
19317
add a comment |
add a comment |
This is a authentication error
, there is not a matching key
to pair to.
When having problems with ssh
or using ssh
over scp
as your doing the -v switch is very informative to diagnose the problem, the more v
's you put in there the more verbose
the output:
scp -vvv -P 30000 /somedir/somedir/file user@domain:/somedir/somedir/
Here is a sample output of it:
OpenSSH_6.7p1 Debian-5+deb8u7, OpenSSL 1.0.1t 3 May 2016
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to 192.168.1.171 [192.168.1.171] port 30000.
debug1: Connection established.
debug1: permanently_set_uid: 0/0
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/identity type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/identity-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_rsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ed25519-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.4p1 Debian-10+deb9u4
debug1: match: OpenSSH_7.4p1 Debian-10+deb9u4 pat OpenSSH* compat 0x04000000
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.7p1 Debian-5+deb8u7
debug2: fd 3 setting O_NONBLOCK
debug3: put_host_port: [192.168.1.171]:30000
debug3: load_hostkeys: loading entries for host "[192.168.1.171]:30000" from file "/root/.ssh/known_hosts"
debug3: load_hostkeys: found key type ECDSA in file /root/.ssh/known_hosts:7
debug3: load_hostkeys: loaded 1 keys
debug3: order_hostkeyalgs: prefer hostkeyalgs: ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
You could check if the permissions
on the ssh
files are rightly set, you can see the right permissions
below in my ls
command
There maybe is someone who deleted your key
from the server.
Or as in the comments someone said, maybe you don't have a matching private key
?
To create a ssh key
if anyone needs that at this stage, this is how you do that:
ssh-keygen -o -b 4096 -t rsa -C your-email@gmail.com
that creates a private key
and a public key
in ~/.ssh/
directory, be careful never to share your private key, that's the id_rsa
....notice that ~/.ssh/
has a dot in front of it because it's a hidden directory like here:
$ls -sail .ssh/
total 20
658 4 drwx------ 2 user user 4096 Nov 10 06:05 .
12 4 drwxr-xr-x 47 user user 4096 Nov 10 06:11 ..
34211 4 -rw-r--r-- 1 user user 1487 Nov 1 02:37 authorized_keys
34375 4 -rw------- 1 user user 3434 Nov 10 06:05 id_rsa
34376 4 -rw-r--r-- 1 user user 749 Nov 10 06:05 id_rsa.pub
664 0 -rw-r--r-- 1 user user 0 Nov 10 06:04 known_hosts
then to copy the key over to the server:
cat ~/.ssh/id_rsa.pub | ssh -p 30000 something@SERVER 'cat >> .ssh/authorized_keys'
You need to get your public
ssh
key
to the server and if you don't have access to it in physical and can edit sshd_config
to allow passwords
# Change to no to disable tunnelled clear text passwords
PasswordAuthentication no
while you copy it, you could email
it to the system administrator
and he can put it on the server.
add a comment |
This is a authentication error
, there is not a matching key
to pair to.
When having problems with ssh
or using ssh
over scp
as your doing the -v switch is very informative to diagnose the problem, the more v
's you put in there the more verbose
the output:
scp -vvv -P 30000 /somedir/somedir/file user@domain:/somedir/somedir/
Here is a sample output of it:
OpenSSH_6.7p1 Debian-5+deb8u7, OpenSSL 1.0.1t 3 May 2016
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to 192.168.1.171 [192.168.1.171] port 30000.
debug1: Connection established.
debug1: permanently_set_uid: 0/0
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/identity type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/identity-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_rsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ed25519-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.4p1 Debian-10+deb9u4
debug1: match: OpenSSH_7.4p1 Debian-10+deb9u4 pat OpenSSH* compat 0x04000000
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.7p1 Debian-5+deb8u7
debug2: fd 3 setting O_NONBLOCK
debug3: put_host_port: [192.168.1.171]:30000
debug3: load_hostkeys: loading entries for host "[192.168.1.171]:30000" from file "/root/.ssh/known_hosts"
debug3: load_hostkeys: found key type ECDSA in file /root/.ssh/known_hosts:7
debug3: load_hostkeys: loaded 1 keys
debug3: order_hostkeyalgs: prefer hostkeyalgs: ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
You could check if the permissions
on the ssh
files are rightly set, you can see the right permissions
below in my ls
command
There maybe is someone who deleted your key
from the server.
Or as in the comments someone said, maybe you don't have a matching private key
?
To create a ssh key
if anyone needs that at this stage, this is how you do that:
ssh-keygen -o -b 4096 -t rsa -C your-email@gmail.com
that creates a private key
and a public key
in ~/.ssh/
directory, be careful never to share your private key, that's the id_rsa
....notice that ~/.ssh/
has a dot in front of it because it's a hidden directory like here:
$ls -sail .ssh/
total 20
658 4 drwx------ 2 user user 4096 Nov 10 06:05 .
12 4 drwxr-xr-x 47 user user 4096 Nov 10 06:11 ..
34211 4 -rw-r--r-- 1 user user 1487 Nov 1 02:37 authorized_keys
34375 4 -rw------- 1 user user 3434 Nov 10 06:05 id_rsa
34376 4 -rw-r--r-- 1 user user 749 Nov 10 06:05 id_rsa.pub
664 0 -rw-r--r-- 1 user user 0 Nov 10 06:04 known_hosts
then to copy the key over to the server:
cat ~/.ssh/id_rsa.pub | ssh -p 30000 something@SERVER 'cat >> .ssh/authorized_keys'
You need to get your public
ssh
key
to the server and if you don't have access to it in physical and can edit sshd_config
to allow passwords
# Change to no to disable tunnelled clear text passwords
PasswordAuthentication no
while you copy it, you could email
it to the system administrator
and he can put it on the server.
add a comment |
This is a authentication error
, there is not a matching key
to pair to.
When having problems with ssh
or using ssh
over scp
as your doing the -v switch is very informative to diagnose the problem, the more v
's you put in there the more verbose
the output:
scp -vvv -P 30000 /somedir/somedir/file user@domain:/somedir/somedir/
Here is a sample output of it:
OpenSSH_6.7p1 Debian-5+deb8u7, OpenSSL 1.0.1t 3 May 2016
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to 192.168.1.171 [192.168.1.171] port 30000.
debug1: Connection established.
debug1: permanently_set_uid: 0/0
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/identity type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/identity-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_rsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ed25519-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.4p1 Debian-10+deb9u4
debug1: match: OpenSSH_7.4p1 Debian-10+deb9u4 pat OpenSSH* compat 0x04000000
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.7p1 Debian-5+deb8u7
debug2: fd 3 setting O_NONBLOCK
debug3: put_host_port: [192.168.1.171]:30000
debug3: load_hostkeys: loading entries for host "[192.168.1.171]:30000" from file "/root/.ssh/known_hosts"
debug3: load_hostkeys: found key type ECDSA in file /root/.ssh/known_hosts:7
debug3: load_hostkeys: loaded 1 keys
debug3: order_hostkeyalgs: prefer hostkeyalgs: ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
You could check if the permissions
on the ssh
files are rightly set, you can see the right permissions
below in my ls
command
There maybe is someone who deleted your key
from the server.
Or as in the comments someone said, maybe you don't have a matching private key
?
To create a ssh key
if anyone needs that at this stage, this is how you do that:
ssh-keygen -o -b 4096 -t rsa -C your-email@gmail.com
that creates a private key
and a public key
in ~/.ssh/
directory, be careful never to share your private key, that's the id_rsa
....notice that ~/.ssh/
has a dot in front of it because it's a hidden directory like here:
$ls -sail .ssh/
total 20
658 4 drwx------ 2 user user 4096 Nov 10 06:05 .
12 4 drwxr-xr-x 47 user user 4096 Nov 10 06:11 ..
34211 4 -rw-r--r-- 1 user user 1487 Nov 1 02:37 authorized_keys
34375 4 -rw------- 1 user user 3434 Nov 10 06:05 id_rsa
34376 4 -rw-r--r-- 1 user user 749 Nov 10 06:05 id_rsa.pub
664 0 -rw-r--r-- 1 user user 0 Nov 10 06:04 known_hosts
then to copy the key over to the server:
cat ~/.ssh/id_rsa.pub | ssh -p 30000 something@SERVER 'cat >> .ssh/authorized_keys'
You need to get your public
ssh
key
to the server and if you don't have access to it in physical and can edit sshd_config
to allow passwords
# Change to no to disable tunnelled clear text passwords
PasswordAuthentication no
while you copy it, you could email
it to the system administrator
and he can put it on the server.
This is a authentication error
, there is not a matching key
to pair to.
When having problems with ssh
or using ssh
over scp
as your doing the -v switch is very informative to diagnose the problem, the more v
's you put in there the more verbose
the output:
scp -vvv -P 30000 /somedir/somedir/file user@domain:/somedir/somedir/
Here is a sample output of it:
OpenSSH_6.7p1 Debian-5+deb8u7, OpenSSL 1.0.1t 3 May 2016
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to 192.168.1.171 [192.168.1.171] port 30000.
debug1: Connection established.
debug1: permanently_set_uid: 0/0
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/identity type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/identity-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_rsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ed25519-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.4p1 Debian-10+deb9u4
debug1: match: OpenSSH_7.4p1 Debian-10+deb9u4 pat OpenSSH* compat 0x04000000
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.7p1 Debian-5+deb8u7
debug2: fd 3 setting O_NONBLOCK
debug3: put_host_port: [192.168.1.171]:30000
debug3: load_hostkeys: loading entries for host "[192.168.1.171]:30000" from file "/root/.ssh/known_hosts"
debug3: load_hostkeys: found key type ECDSA in file /root/.ssh/known_hosts:7
debug3: load_hostkeys: loaded 1 keys
debug3: order_hostkeyalgs: prefer hostkeyalgs: ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
You could check if the permissions
on the ssh
files are rightly set, you can see the right permissions
below in my ls
command
There maybe is someone who deleted your key
from the server.
Or as in the comments someone said, maybe you don't have a matching private key
?
To create a ssh key
if anyone needs that at this stage, this is how you do that:
ssh-keygen -o -b 4096 -t rsa -C your-email@gmail.com
that creates a private key
and a public key
in ~/.ssh/
directory, be careful never to share your private key, that's the id_rsa
....notice that ~/.ssh/
has a dot in front of it because it's a hidden directory like here:
$ls -sail .ssh/
total 20
658 4 drwx------ 2 user user 4096 Nov 10 06:05 .
12 4 drwxr-xr-x 47 user user 4096 Nov 10 06:11 ..
34211 4 -rw-r--r-- 1 user user 1487 Nov 1 02:37 authorized_keys
34375 4 -rw------- 1 user user 3434 Nov 10 06:05 id_rsa
34376 4 -rw-r--r-- 1 user user 749 Nov 10 06:05 id_rsa.pub
664 0 -rw-r--r-- 1 user user 0 Nov 10 06:04 known_hosts
then to copy the key over to the server:
cat ~/.ssh/id_rsa.pub | ssh -p 30000 something@SERVER 'cat >> .ssh/authorized_keys'
You need to get your public
ssh
key
to the server and if you don't have access to it in physical and can edit sshd_config
to allow passwords
# Change to no to disable tunnelled clear text passwords
PasswordAuthentication no
while you copy it, you could email
it to the system administrator
and he can put it on the server.
answered Nov 10 '18 at 7:05
somethingSomething
1601213
1601213
add a comment |
add a comment |
This solved it for me:
ssh-keygen -f "/home/local/.../.ssh/known_hosts" -R
1
Can you explain those switches please?
– Fazer87
Apr 24 '15 at 7:00
add a comment |
This solved it for me:
ssh-keygen -f "/home/local/.../.ssh/known_hosts" -R
1
Can you explain those switches please?
– Fazer87
Apr 24 '15 at 7:00
add a comment |
This solved it for me:
ssh-keygen -f "/home/local/.../.ssh/known_hosts" -R
This solved it for me:
ssh-keygen -f "/home/local/.../.ssh/known_hosts" -R
answered Apr 23 '15 at 18:21
Doug Null
2822623
2822623
1
Can you explain those switches please?
– Fazer87
Apr 24 '15 at 7:00
add a comment |
1
Can you explain those switches please?
– Fazer87
Apr 24 '15 at 7:00
1
1
Can you explain those switches please?
– Fazer87
Apr 24 '15 at 7:00
Can you explain those switches please?
– Fazer87
Apr 24 '15 at 7:00
add a comment |
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
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
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f95171%2fscp-error-permission-denied-publickey-lost-connection%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
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
Required, but never shown
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
Required, but never shown
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
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
might get a better response on superuser.com
– Brian
Jan 13 '10 at 3:44
Have you uploaded a public key to authenticate with? Is it the one matching the private key in ~/.ssh ?
– sth
Jan 13 '10 at 3:45
Use more v's -- scp -vv or -vvv should give even more verbose log messages.
– Jim Lewis
Jan 13 '10 at 3:53
Also, disregard any advice to post all the files under your .ssh directory so we can check them for typos.
– Jim Lewis
Jan 13 '10 at 3:53