Cannot connect to server using my public key
Multi tool use
up vote
-2
down vote
favorite
I copied my public key to ~/.ssh/authorized_keys
on the server. Now I'm trying to establish an ssh connection, but it doesn't work.
This is the output from ssh -v
(server domain and ip address redacted)
OpenSSH_7.2p2 Ubuntu-4ubuntu2.5, OpenSSL 1.0.2g 1 Mar 2016
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to <Server> [ip] port 22.
debug1: Connection established.
debug1: identity file /var/lib/jenkins/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /var/lib/jenkins/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /var/lib/jenkins/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /var/lib/jenkins/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /var/lib/jenkins/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /var/lib/jenkins/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /var/lib/jenkins/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /var/lib/jenkins/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.5
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.2p2 Ubuntu-4ubuntu2.6
debug1: match: OpenSSH_7.2p2 Ubuntu-4ubuntu2.6 pat OpenSSH* compat 0x04000000
debug1: Authenticating to <server>:<port> as 'jenkins'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256@libssh.org
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:oDdpyTTKXVwLAF7RvyrBmTdtiYusX9Kh5unb/IVhQT0
debug1: Host <server> is known and matches the ECDSA host key.
debug1: Found key in /var/lib/jenkins/.ssh/known_hosts:5
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<rsa-sha2-256,rsa-sha2-512>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /var/lib/jenkins/.ssh/id_rsa
debug1: Authentications that can continue: publickey
debug1: Trying private key: /var/lib/jenkins/.ssh/id_dsa
debug1: Trying private key: /var/lib/jenkins/.ssh/id_ecdsa
debug1: Trying private key: /var/lib/jenkins/.ssh/id_ed25519
debug1: No more authentication methods to try.
Already made sure to assign the correct permissions to the content of .ssh on the server and I have another uxder being able to login to the server using public key.
Any idea what the problem might be?
ubuntu ssh ubuntu-16.04 public-key
New contributor
add a comment |
up vote
-2
down vote
favorite
I copied my public key to ~/.ssh/authorized_keys
on the server. Now I'm trying to establish an ssh connection, but it doesn't work.
This is the output from ssh -v
(server domain and ip address redacted)
OpenSSH_7.2p2 Ubuntu-4ubuntu2.5, OpenSSL 1.0.2g 1 Mar 2016
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to <Server> [ip] port 22.
debug1: Connection established.
debug1: identity file /var/lib/jenkins/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /var/lib/jenkins/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /var/lib/jenkins/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /var/lib/jenkins/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /var/lib/jenkins/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /var/lib/jenkins/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /var/lib/jenkins/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /var/lib/jenkins/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.5
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.2p2 Ubuntu-4ubuntu2.6
debug1: match: OpenSSH_7.2p2 Ubuntu-4ubuntu2.6 pat OpenSSH* compat 0x04000000
debug1: Authenticating to <server>:<port> as 'jenkins'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256@libssh.org
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:oDdpyTTKXVwLAF7RvyrBmTdtiYusX9Kh5unb/IVhQT0
debug1: Host <server> is known and matches the ECDSA host key.
debug1: Found key in /var/lib/jenkins/.ssh/known_hosts:5
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<rsa-sha2-256,rsa-sha2-512>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /var/lib/jenkins/.ssh/id_rsa
debug1: Authentications that can continue: publickey
debug1: Trying private key: /var/lib/jenkins/.ssh/id_dsa
debug1: Trying private key: /var/lib/jenkins/.ssh/id_ecdsa
debug1: Trying private key: /var/lib/jenkins/.ssh/id_ed25519
debug1: No more authentication methods to try.
Already made sure to assign the correct permissions to the content of .ssh on the server and I have another uxder being able to login to the server using public key.
Any idea what the problem might be?
ubuntu ssh ubuntu-16.04 public-key
New contributor
Are you connecting as the correct user (jenkins)? Did you edit theauthorized_keys
in the correct user's home directory?
– Sjoerd
3 hours ago
add a comment |
up vote
-2
down vote
favorite
up vote
-2
down vote
favorite
I copied my public key to ~/.ssh/authorized_keys
on the server. Now I'm trying to establish an ssh connection, but it doesn't work.
This is the output from ssh -v
(server domain and ip address redacted)
OpenSSH_7.2p2 Ubuntu-4ubuntu2.5, OpenSSL 1.0.2g 1 Mar 2016
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to <Server> [ip] port 22.
debug1: Connection established.
debug1: identity file /var/lib/jenkins/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /var/lib/jenkins/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /var/lib/jenkins/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /var/lib/jenkins/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /var/lib/jenkins/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /var/lib/jenkins/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /var/lib/jenkins/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /var/lib/jenkins/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.5
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.2p2 Ubuntu-4ubuntu2.6
debug1: match: OpenSSH_7.2p2 Ubuntu-4ubuntu2.6 pat OpenSSH* compat 0x04000000
debug1: Authenticating to <server>:<port> as 'jenkins'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256@libssh.org
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:oDdpyTTKXVwLAF7RvyrBmTdtiYusX9Kh5unb/IVhQT0
debug1: Host <server> is known and matches the ECDSA host key.
debug1: Found key in /var/lib/jenkins/.ssh/known_hosts:5
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<rsa-sha2-256,rsa-sha2-512>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /var/lib/jenkins/.ssh/id_rsa
debug1: Authentications that can continue: publickey
debug1: Trying private key: /var/lib/jenkins/.ssh/id_dsa
debug1: Trying private key: /var/lib/jenkins/.ssh/id_ecdsa
debug1: Trying private key: /var/lib/jenkins/.ssh/id_ed25519
debug1: No more authentication methods to try.
Already made sure to assign the correct permissions to the content of .ssh on the server and I have another uxder being able to login to the server using public key.
Any idea what the problem might be?
ubuntu ssh ubuntu-16.04 public-key
New contributor
I copied my public key to ~/.ssh/authorized_keys
on the server. Now I'm trying to establish an ssh connection, but it doesn't work.
This is the output from ssh -v
(server domain and ip address redacted)
OpenSSH_7.2p2 Ubuntu-4ubuntu2.5, OpenSSL 1.0.2g 1 Mar 2016
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to <Server> [ip] port 22.
debug1: Connection established.
debug1: identity file /var/lib/jenkins/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /var/lib/jenkins/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /var/lib/jenkins/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /var/lib/jenkins/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /var/lib/jenkins/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /var/lib/jenkins/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /var/lib/jenkins/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /var/lib/jenkins/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.5
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.2p2 Ubuntu-4ubuntu2.6
debug1: match: OpenSSH_7.2p2 Ubuntu-4ubuntu2.6 pat OpenSSH* compat 0x04000000
debug1: Authenticating to <server>:<port> as 'jenkins'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256@libssh.org
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:oDdpyTTKXVwLAF7RvyrBmTdtiYusX9Kh5unb/IVhQT0
debug1: Host <server> is known and matches the ECDSA host key.
debug1: Found key in /var/lib/jenkins/.ssh/known_hosts:5
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<rsa-sha2-256,rsa-sha2-512>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /var/lib/jenkins/.ssh/id_rsa
debug1: Authentications that can continue: publickey
debug1: Trying private key: /var/lib/jenkins/.ssh/id_dsa
debug1: Trying private key: /var/lib/jenkins/.ssh/id_ecdsa
debug1: Trying private key: /var/lib/jenkins/.ssh/id_ed25519
debug1: No more authentication methods to try.
Already made sure to assign the correct permissions to the content of .ssh on the server and I have another uxder being able to login to the server using public key.
Any idea what the problem might be?
ubuntu ssh ubuntu-16.04 public-key
ubuntu ssh ubuntu-16.04 public-key
New contributor
New contributor
edited 2 hours ago
Tomasz Jakub Rup
508313
508313
New contributor
asked 5 hours ago
rubentd
971
971
New contributor
New contributor
Are you connecting as the correct user (jenkins)? Did you edit theauthorized_keys
in the correct user's home directory?
– Sjoerd
3 hours ago
add a comment |
Are you connecting as the correct user (jenkins)? Did you edit theauthorized_keys
in the correct user's home directory?
– Sjoerd
3 hours ago
Are you connecting as the correct user (jenkins)? Did you edit the
authorized_keys
in the correct user's home directory?– Sjoerd
3 hours ago
Are you connecting as the correct user (jenkins)? Did you edit the
authorized_keys
in the correct user's home directory?– Sjoerd
3 hours ago
add a comment |
2 Answers
2
active
oldest
votes
up vote
0
down vote
ssh-copy-id
takes the guesswork out of migrating keys to your machines. To copy your default key you just run:
ssh-copy-id user@newserver.com
If you have multiple SSH keys that you use you can use the -i
flag to indicate which one you want to send to the new machine. Like so:
ssh-copy-id -i /path/to/new_id_rsa user@newserver.com
add a comment |
up vote
-1
down vote
I copied my public key to ~/.ssh/authorized_keys on the server.
This is the problem. You must copy private key.
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
ssh-copy-id
takes the guesswork out of migrating keys to your machines. To copy your default key you just run:
ssh-copy-id user@newserver.com
If you have multiple SSH keys that you use you can use the -i
flag to indicate which one you want to send to the new machine. Like so:
ssh-copy-id -i /path/to/new_id_rsa user@newserver.com
add a comment |
up vote
0
down vote
ssh-copy-id
takes the guesswork out of migrating keys to your machines. To copy your default key you just run:
ssh-copy-id user@newserver.com
If you have multiple SSH keys that you use you can use the -i
flag to indicate which one you want to send to the new machine. Like so:
ssh-copy-id -i /path/to/new_id_rsa user@newserver.com
add a comment |
up vote
0
down vote
up vote
0
down vote
ssh-copy-id
takes the guesswork out of migrating keys to your machines. To copy your default key you just run:
ssh-copy-id user@newserver.com
If you have multiple SSH keys that you use you can use the -i
flag to indicate which one you want to send to the new machine. Like so:
ssh-copy-id -i /path/to/new_id_rsa user@newserver.com
ssh-copy-id
takes the guesswork out of migrating keys to your machines. To copy your default key you just run:
ssh-copy-id user@newserver.com
If you have multiple SSH keys that you use you can use the -i
flag to indicate which one you want to send to the new machine. Like so:
ssh-copy-id -i /path/to/new_id_rsa user@newserver.com
answered 2 hours ago
Chris Black
213
213
add a comment |
add a comment |
up vote
-1
down vote
I copied my public key to ~/.ssh/authorized_keys on the server.
This is the problem. You must copy private key.
add a comment |
up vote
-1
down vote
I copied my public key to ~/.ssh/authorized_keys on the server.
This is the problem. You must copy private key.
add a comment |
up vote
-1
down vote
up vote
-1
down vote
I copied my public key to ~/.ssh/authorized_keys on the server.
This is the problem. You must copy private key.
I copied my public key to ~/.ssh/authorized_keys on the server.
This is the problem. You must copy private key.
answered 3 hours ago
Tomasz Jakub Rup
508313
508313
add a comment |
add a comment |
rubentd is a new contributor. Be nice, and check out our Code of Conduct.
rubentd is a new contributor. Be nice, and check out our Code of Conduct.
rubentd is a new contributor. Be nice, and check out our Code of Conduct.
rubentd is a new contributor. Be nice, and check out our Code of Conduct.
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%2fsuperuser.com%2fquestions%2f1374928%2fcannot-connect-to-server-using-my-public-key%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
Post as a guest
oinDxTKnxZTP jF8qi7sBfJyVpaAz,TfGYBdfVNwjj u9X0SdV,wUeDnM2YsJS4UB1sR5ZjkVVwM3fOIDL4ps6t,2oSs UK0 h D9tm
Are you connecting as the correct user (jenkins)? Did you edit the
authorized_keys
in the correct user's home directory?– Sjoerd
3 hours ago