in ssh(), always use heredoc notation so $cmd can contain pipes and semicolons and quotes freely