Check existing setup:
grep "SSHKeyLocation=" /usr/local/etc/zabbix_server.conf
Enable SSHKeyLocation:
sed -i "s/^.*SSHKeyLocation=/SSHKeyLocation=\/home\/zabbix\/.ssh/" /usr/local/etc/zabbix_server.conf
Check again:
grep "SSHKeyLocation=" /usr/local/etc/zabbix_server.conf
Make directory for SSH keys
mkdir -p /home/zabbix/.ssh
Allow zabbix user to own the dir
chown -R zabbix:zabbix /home/zabbix
Restart Zabbix server service:
systemctl restart zabbix-server
Open /etc/passwd and make sure zabbix home dir has been set to /home/zabbix
zabbix:x:1001:1001::/home/zabbix:/usr/sbin/nologin
Generate the SSH key for user zabbix:
sudo -u zabbix ssh-keygen -t rsa -b 2048
This will ask for passphrase. You can enter noneCopy key to remote host:
sudo -u zabbix ssh-copy-id pi@ip.address.goes.here -p 22
Note that SSH key will be installed only on user in this command ('root' in my example)
Move to user zabbix to test the connection:
su -s /bin/bash zabbix
Test the login:
ssh -p '22' 'pi@ip.address.goes.here'
Note that now the authorization is passwordlessExit SSH session. Exit user zabbix session
Now on the fronend I can create a key: