create new SSH key-pair

CentOS 7.3. iRedMail groupware.

Started to login and be banned/blocked every time. Would clear iptables, hosts.deny each time. Did not seem to be caused by Fail2Ban or OSSEC.

Though to start key-pair over again. https://www.linode.com/docs/security/se … n-key-pair">https://www.linode.com/docs/security/securing-your-server#create-an-authentication-key-pair

Has not worked. What am I missing?

On the Linode.

$ ls -alF .ssh

drwx------ 2 davida davida 4096 Feb 1 16:46 ./

drwx------ 11 davida davida 4096 Feb 1 16:46 ../

-rw------- 1 davida davida 741 Feb 1 16:46 authorized_keys

On local computer:

$ ssh-keygen -f "/home/david/.ssh/known_hosts" -R IP address

$ ssh-copy-id davida@IPaddress

/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed

/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed – if you are prompted now it is to install the new keys

davida@IPaddress's password:

Number of key(s) added: 1

Now try logging into the machine, with: "ssh 'davida@IP address'"

and check to make sure that only the key(s) you wanted were added.

$ ssh -vvv davida@ IP address

OpenSSH_6.7p1 Debian-5+deb8u3, 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 "IP address" port 22.

debug1: Connection established.

debug1: identity file /home/david/.ssh/id_rsa type 1

debug1: keyloadpublic: No such file or directory

debug1: identity file /home/david/.ssh/id_rsa-cert type -1

debug1: keyloadpublic: No such file or directory

debug1: identity file /home/david/.ssh/id_dsa type -1

debug1: keyloadpublic: No such file or directory

debug1: identity file /home/david/.ssh/id_dsa-cert type -1

debug1: keyloadpublic: No such file or directory

debug1: identity file /home/david/.ssh/id_ecdsa type -1

debug1: keyloadpublic: No such file or directory

debug1: identity file /home/david/.ssh/id_ecdsa-cert type -1

debug1: keyloadpublic: No such file or directory

debug1: identity file /home/david/.ssh/id_ed25519 type -1

debug1: keyloadpublic: No such file or directory

debug1: identity file /home/david/.ssh/id_ed25519-cert type -1

debug1: Enabling compatibility mode for protocol 2.0

debug1: Local version string SSH-2.0-OpenSSH_6.7p1 Debian-5+deb8u3

debug1: Remote protocol version 2.0, remote software version OpenSSH_6.6.1

debug1: match: OpenSSH6.6.1 pat OpenSSH6.6.1* compat 0x04000000

debug2: fd 3 setting O_NONBLOCK

debug3: loadhostkeys: loading entries for host "IP address" from file "/home/david/.ssh/knownhosts"

debug3: loadhostkeys: found key type ECDSA in file /home/david/.ssh/knownhosts:53

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: SSH2MSGKEXINIT sent

debug1: SSH2MSGKEXINIT received

debug2: kexparsekexinit: curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1

debug2: kexparsekexinit: 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,ssh-ed25519-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,ssh-dss-cert-v01@openssh.com,ssh-rsa-cert-v00@openssh.com,ssh-dss-cert-v00@openssh.com,ssh-ed25519,ssh-rsa,ssh-dss

debug2: kexparsekexinit: aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se

debug2: kexparsekexinit: aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se

debug2: kexparsekexinit: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1,hmac-md5-etm@openssh.com,hmac-ripemd160-etm@openssh.com,hmac-sha1-96-etm@openssh.com,hmac-md5-96-etm@openssh.com,hmac-md5,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96

debug2: kexparsekexinit: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1,hmac-md5-etm@openssh.com,hmac-ripemd160-etm@openssh.com,hmac-sha1-96-etm@openssh.com,hmac-md5-96-etm@openssh.com,hmac-md5,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96

debug2: kexparsekexinit: none,zlib@openssh.com,zlib

debug2: kexparsekexinit: none,zlib@openssh.com,zlib

debug2: kexparsekexinit:

debug2: kexparsekexinit:

debug2: kexparsekexinit: firstkexfollows 0

debug2: kexparsekexinit: reserved 0

debug2: kexparsekexinit: curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1

debug2: kexparsekexinit: ssh-rsa,ecdsa-sha2-nistp256,ssh-ed25519

debug2: kexparsekexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se

debug2: kexparsekexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se

debug2: kexparsekexinit: hmac-md5-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-ripemd160-etm@openssh.com,hmac-sha1-96-etm@openssh.com,hmac-md5-96-etm@openssh.com,hmac-md5,hmac-sha1,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96

debug2: kexparsekexinit: hmac-md5-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-ripemd160-etm@openssh.com,hmac-sha1-96-etm@openssh.com,hmac-md5-96-etm@openssh.com,hmac-md5,hmac-sha1,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96

debug2: kexparsekexinit: none,zlib@openssh.com

debug2: kexparsekexinit: none,zlib@openssh.com

debug2: kexparsekexinit:

debug2: kexparsekexinit:

debug2: kexparsekexinit: firstkexfollows 0

debug2: kexparsekexinit: reserved 0

debug2: mac_setup: setup umac-64-etm@openssh.com

debug1: kex: server->client aes128-ctr umac-64-etm@openssh.com none

debug2: mac_setup: setup umac-64-etm@openssh.com

debug1: kex: client->server aes128-ctr umac-64-etm@openssh.com none

debug1: sending SSH2MSGKEXECDHINIT

debug1: expecting SSH2MSGKEXECDHREPLY

debug1: Server host key: ECDSA d1:e2:0a:ef:80:4f:79:78:4b:06:c3:80:ad:78:6a:bf

debug3: loadhostkeys: loading entries for host "IP address" from file "/home/david/.ssh/knownhosts"

debug3: loadhostkeys: found key type ECDSA in file /home/david/.ssh/knownhosts:53

debug3: load_hostkeys: loaded 1 keys

debug1: Host 'IP address' is known and matches the ECDSA host key.

debug1: Found key in /home/david/.ssh/known_hosts:53

debug2: kexderivekeys

debug2: set_newkeys: mode 1

debug1: SSH2MSGNEWKEYS sent

debug1: expecting SSH2MSGNEWKEYS

debug2: set_newkeys: mode 0

debug1: SSH2MSGNEWKEYS received

debug1: SSH2MSGSERVICE_REQUEST sent

debug2: service_accept: ssh-userauth

debug1: SSH2MSGSERVICE_ACCEPT received

debug2: key: /home/david/.ssh/id_rsa (0x7fce4256c530),

debug2: key: /home/david/.ssh/id_dsa ((nil)),

debug2: key: /home/david/.ssh/id_ecdsa ((nil)),

debug2: key: /home/david/.ssh/id_ed25519 ((nil)),

debug1: Authentications that can continue: publickey

debug3: start over, passed a different list publickey

debug3: preferred gssapi-keyex,gssapi-with-mic,publickey,keyboard-interactive,password

debug3: authmethod_lookup publickey

debug3: remaining preferred: keyboard-interactive,password

debug3: authmethodisenabled publickey

debug1: Next authentication method: publickey

debug1: Offering RSA public key: /home/david/.ssh/id_rsa

debug3: sendpubkeytest

debug2: we sent a publickey packet, wait for reply

debug1: Server accepts key: pkalg ssh-rsa blen 535

debug2: inputuserauthpk_ok: fp 93:09:88:90:0a:fe:1c:2c:05:42:9c:12:8c:02:dd:dd

debug3: signandsend_pubkey: RSA 93:09:88:90:0a:fe:1c:2c:05:42:9c:12:8c:02:dd:dd

Agent admitted failure to sign using the key.

debug1: Trying private key: /home/david/.ssh/id_dsa

debug3: no such identity: /home/david/.ssh/id_dsa: No such file or directory

debug1: Trying private key: /home/david/.ssh/id_ecdsa

debug3: no such identity: /home/david/.ssh/id_ecdsa: No such file or directory

debug1: Trying private key: /home/david/.ssh/id_ed25519

debug3: no such identity: /home/david/.ssh/id_ed25519: No such file or directory

debug2: we did not send a packet, disable method

debug1: No more authentication methods to try.

Permission denied (publickey).

3 Replies

Problem is getting as far as the password prompt to open local keyring.

Local is Debian 8.5. https://bugs.launchpad.net/ubuntu/+sour … ug/1387303">https://bugs.launchpad.net/ubuntu/+source/gnome-keyring/+bug/1387303 not applicable.

[Wed Feb 01 19:26:45 david@ASUS-U56E:~ ] $ SSHAUTHSOCK=0 ssh -v davida@IPaddress

OpenSSH_6.7p1 Debian-5+deb8u3, 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 *

debug1: Connecting to IPaddress port 22.

debug1: Connection established.

debug1: identity file /home/david/.ssh/id_rsa type 1

debug1: keyloadpublic: No such file or directory

debug1: identity file /home/david/.ssh/id_rsa-cert type -1

debug1: keyloadpublic: No such file or directory

debug1: identity file /home/david/.ssh/id_dsa type -1

debug1: keyloadpublic: No such file or directory

debug1: identity file /home/david/.ssh/id_dsa-cert type -1

debug1: keyloadpublic: No such file or directory

debug1: identity file /home/david/.ssh/id_ecdsa type -1

debug1: keyloadpublic: No such file or directory

debug1: identity file /home/david/.ssh/id_ecdsa-cert type -1

debug1: keyloadpublic: No such file or directory

debug1: identity file /home/david/.ssh/id_ed25519 type -1

debug1: keyloadpublic: No such file or directory

debug1: identity file /home/david/.ssh/id_ed25519-cert type -1

debug1: Enabling compatibility mode for protocol 2.0

debug1: Local version string SSH-2.0-OpenSSH_6.7p1 Debian-5+deb8u3

debug1: Remote protocol version 2.0, remote software version OpenSSH_6.6.1

debug1: match: OpenSSH6.6.1 pat OpenSSH6.6.1* compat 0x04000000

debug1: SSH2MSGKEXINIT sent

debug1: SSH2MSGKEXINIT received

debug1: kex: server->client aes128-ctr umac-64-etm@openssh.com none

debug1: kex: client->server aes128-ctr umac-64-etm@openssh.com none

debug1: sending SSH2MSGKEXECDHINIT

debug1: expecting SSH2MSGKEXECDHREPLY

debug1: Server host key: ECDSA d1:e2:0a:ef:80:4f:79:78:4b:06:c3:80:ad:78:6a:bf

debug1: Host 'IPaddress' is known and matches the ECDSA host key.

debug1: Found key in /home/david/.ssh/known_hosts:53

debug1: SSH2MSGNEWKEYS sent

debug1: expecting SSH2MSGNEWKEYS

debug1: SSH2MSGNEWKEYS received

debug1: SSH2MSGSERVICE_REQUEST sent

debug1: SSH2MSGSERVICE_ACCEPT received

debug1: Authentications that can continue: publickey

debug1: Next authentication method: publickey

debug1: Offering RSA public key: /home/david/.ssh/id_rsa

debug1: Server accepts key: pkalg ssh-rsa blen 535

debug1: keyloadprivate_type: incorrect passphrase supplied to decrypt private key

Enter passphrase for key '/home/david/.ssh/id_rsa':

debug1: Authentication succeeded (publickey).

Authenticated to (IPaddress:22).

debug1: channel 0: new [client-session]

debug1: Requesting no-more-sessions@openssh.com

debug1: Entering interactive session.

debug1: Sending environment.

debug1: Sending env LANG = en_US.UTF-8

Last login: Wed Feb 1 14:16:46 2017

Looking good.

LISH: Enabled SSH password login.

Local: Ran ssh-copy-id.

LISH: Disabled SSH password login.

SSH Local: key-pair working again.

The connection at work has been blocked twice today. More than SSH. Firewall on Linode blocks office IP address.

Where to looks for a cause? Not /var/log/messages. Not OSSEC.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct