in reply to permission problem with Net::SSH::Perl

That gives me a similar error except instead of trying to write to /var/www it wants to write to /root

Not sure, but maybe it would help to explicitly specify the place where you want the known hosts info to be kept, e.g.

my $ssh = Net::SSH::Perl->new( $remote_host, protocol=>2, options => [ "UserKnownHostsFile /some/path/.ssh/known_hosts" +] # or "GlobalKnownHostsFile /some/path/.ssh/known_ +hosts" ) or die("could not connect");