Ad Widget

Collapse

Public key authentication failed: Username/PublicKey combination invalid

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • LipstickLinux
    Junior Member
    • Mar 2017
    • 1

    #1

    Public key authentication failed: Username/PublicKey combination invalid

    Good morning/afternoon/evening, all.

    I inherited a Zabbix (v3.2.6 on RHEL 7.3) monitoring environment and am tasked with creating an action for restarting a service on a triggering host. I have created an Action Operation using SSH to run the commands on the host, but I don't like the password method of connecting. (It worked when I tested it, but the password is not cloaked, and I don't want it seen.)

    I am trying to use the public key method, therefore. So, I took these steps to make that happen:
    - Created, chown'ed, and chmod'ed the zabbix user's home directory at /var/lib/zabbix.
    - Ran ssh-keygen to create the key pair.
    - Modified /etc/zabbix/zabbix_server.conf to point it to /var/lib/zabbix/.ssh.
    - Used ssh-copy-id to copy the public key to the affected host.
    - Configured the operation (within the action) to connect via the "zabbix" user and provided id_rsa.pub and id_rsa as the public and private keys, resp.
    - Killed the service I was testing (apache2) on the affected host.

    The action fired, and the error I received was that in the subject, "Public key authentication failed: Username/PublicKey combination invalid".

    I've searched the web and searched these forums and cannot find what I'm doing wrong. Would appreciate some help, if you can provide it.

    Thanks in advance!
    Last edited by LipstickLinux; 20-07-2018, 17:16.
  • tamas-p
    Junior Member
    • Aug 2018
    • 15

    #2
    Hi,

    I have the very same issue. I have followed the 3.4 documentation step-by-step, and all I've got is Public key combination invalid.



    If I take over the zabbix user, and run ssh root@target it, logs in fine as root.
    Looking at the target's log, it does try to login as zabbix user rather than root.
    Why the official documentation say "sudo -u zabbix ssh-copy-id [email protected]" if the system wouldn't do the root at the first place?
    How do I set the username here for the target?
    I have tried the key like this: ssh.run[test1,root@target,22,utf-8]
    But same issue.
    It is fairly problematic for me to create a "zabbix user" on the target system... would be great if I could use this with some existing user....

    Thanks

    Comment


    • tamas-p
      tamas-p commented
      Editing a comment
      Ok, apparently I haven't seen there is a user field when I select the Public key version of ssh during the item setup...
      It is working now.
Working...