I have tried to follow your instructions It might be that I am misunderstanding the where and what to copy.
Please clarify if I am doing something incorrectly.
On my zabbix server, in my users home directory, I ran all the necessary commands.
sudo mkdir ~/.ssh/zabbix && sudo chown zabbix ~/.ssh/zabbix && cd ~/.ssh/zabbix
sudo -u zabbix ssh-keygen -P "" -t rsa -m pem -f zb_id_rsa
This is the results. As you can see the files are owned by zabbix.
username@zabbix:$ ls -ltr .ssh/zabbix/
total 8
-rw-r--r-- 1 zabbix zabbix 567 Apr 26 12:16 zb_id_rsa.pub
-rw------- 1 zabbix zabbix 2455 Apr 26 12:16 zb_id_rsa
username@zabbix:$ sudo -u zabbix ssh-copy-id -i /home/username/.ssh/zabbix/zb_id_rsa 192.168.1.1
/usr/bin/ssh-copy-id: ERROR: failed to open ID file '/home/username/.ssh/zabbix/zb_id_rsa.pub': Permission denied
I have also added the public key into the unifi controller. This was no issue.
Is it possible that I should do the ssh-copy-id to the unifi server and not to my gateway?
I also tried your script that you created.
username@zabbix:~$ ./updatePublicKey.sh -i /home/username/.ssh/zabbix/zb_id_rsa -u zabbix -R -4 -n user@192.168.1.1
Host 192.168.1.1 found: line 12
/home/username/.ssh/known_hosts updated.
Original contents retained as /home/username/.ssh/known_hosts.old
Warning: Identity file /home/username/.ssh/zabbix/zb_id_rsa not accessible: Permission denied.
Need to update public key for user@192.168.1.1
Password:
Password:
username@zabbix:~$
Thanks for your input with what I am doing wrong.
Lawrence
I have tried to follow your instructions It might be that I am misunderstanding the where and what to copy.
Please clarify if I am doing something incorrectly.
On my zabbix server, in my users home directory, I ran all the necessary commands.
sudo mkdir ~/.ssh/zabbix && sudo chown zabbix ~/.ssh/zabbix && cd ~/.ssh/zabbix
sudo -u zabbix ssh-keygen -P "" -t rsa -m pem -f zb_id_rsa
This is the results. As you can see the files are owned by zabbix.
username@zabbix:
$ ls -ltr .ssh/zabbix/$ sudo -u zabbix ssh-copy-id -i /home/username/.ssh/zabbix/zb_id_rsa 192.168.1.1total 8
-rw-r--r-- 1 zabbix zabbix 567 Apr 26 12:16 zb_id_rsa.pub
-rw------- 1 zabbix zabbix 2455 Apr 26 12:16 zb_id_rsa
username@zabbix:
/usr/bin/ssh-copy-id: ERROR: failed to open ID file '/home/username/.ssh/zabbix/zb_id_rsa.pub': Permission denied
I have also added the public key into the unifi controller. This was no issue.
Is it possible that I should do the ssh-copy-id to the unifi server and not to my gateway?
I also tried your script that you created.
username@zabbix:~$ ./updatePublicKey.sh -i /home/username/.ssh/zabbix/zb_id_rsa -u zabbix -R -4 -n user@192.168.1.1
Host 192.168.1.1 found: line 12
/home/username/.ssh/known_hosts updated.
Original contents retained as /home/username/.ssh/known_hosts.old
Warning: Identity file /home/username/.ssh/zabbix/zb_id_rsa not accessible: Permission denied.
Need to update public key for user@192.168.1.1
Password:
Password:
username@zabbix:~$
Thanks for your input with what I am doing wrong.
Lawrence