for example. add known_host to remote server. you cannot su www-data as its not permitted by default, so you can run:
sudo -u www-data ssh root@remote_ip
additionally, you can test if www-data has permission to open a file:
sudo -u www-data less /root/.ssh/authorized_keys
to check if you have a permissions problem.