I am making a buildroot system with an ssh server and I would like to fix the ssh keys used by the server by adding them in my filesystem overlay. the private keys need to have limited rights (read write for the owner and nothing else).
when I build, those rights are changed in target filesystem and the ssh server don't start because rights are too open.
$ ls -lh ./rootfs_overlay/etc/ssh
total 596K
-rw-r--r-- 1 william william 553K sept. 12 10:46 moduli
-rw-r--r-- 1 william william 1,5K sept. 12 10:46 ssh_config
-rw-r--r-- 1 william william 3,1K sept. 26 11:27 sshd_config
-rw------- 1 william william 1,4K oct. 3 16:22 ssh_host_dsa_key
-rw-r--r-- 1 william william 604 oct. 3 16:22 ssh_host_dsa_key.pub
-rw------- 1 william william 505 oct. 3 16:22 ssh_host_ecdsa_key
-rw-r--r-- 1 william william 176 oct. 3 16:22 ssh_host_ecdsa_key.pub
-rw------- 1 william william 411 oct. 3 16:22 ssh_host_ed25519_key
-rw-r--r-- 1 william william 96 oct. 3 16:22 ssh_host_ed25519_key.pub
-rw------- 1 william william 1,8K oct. 3 16:22 ssh_host_rsa_key
-rw-r--r-- 1 william william 396 oct. 3 16:22 ssh_host_rsa_key.pub
$ ls -lh ./output/target/etc/ssh/
total 596K
-rw-r--r-- 1 william william 553K sept. 12 10:46 moduli
-rw-r--r-- 1 william william 1,5K sept. 12 10:46 ssh_config
-rw-r--r-- 1 william william 3,1K sept. 26 11:27 sshd_config
-rw-r--r-- 1 william william 1,4K oct. 3 16:22 ssh_host_dsa_key
-rw-r--r-- 1 william william 604 oct. 3 16:22 ssh_host_dsa_key.pub
-rw-r--r-- 1 william william 505 oct. 3 16:22 ssh_host_ecdsa_key
-rw-r--r-- 1 william william 176 oct. 3 16:22 ssh_host_ecdsa_key.pub
-rw-r--r-- 1 william william 411 oct. 3 16:22 ssh_host_ed25519_key
-rw-r--r-- 1 william william 96 oct. 3 16:22 ssh_host_ed25519_key.pub
-rw-r--r-- 1 william william 1,8K oct. 3 16:22 ssh_host_rsa_key
-rw-r--r-- 1 william william 396 oct. 3 16:22 ssh_host_rsa_key.pub
buildroot is using rsync for this transfer and is supposed to preserve rights. I don't know what I can do to preserve those rights.