my $cmd = "/usr/bin/ssh -t -i \$HOME/.ssh/privkey user\@machineC '/usr/bin/ssh -t -l user machineD \"mkdir \$HOME/.ssh;chmod go-w \$HOME && chmod go-w \$HOME/.ssh && ( echo $public_key ) >>\$HOME/.ssh/authorized_keys\"'";