Set root password for centos or ubuntu

i haven’t tried it, but in a normal situation, i would think you’d want to use sudo, after you’ve logged in as whatever user for which you supplied the SSH key. don’t forget that “sudo su -” usually works just fine.