hint (on client side, how to encrypt files/pwd's):
# encrypt pwd with ssh key: openssl rsa -in ~/.ssh/id_rsa -outform pem > ~/.ssh/TEMP-id_rsa.pem 2>/dev/null openssl rsa -in ~/.ssh/id_rsa -pubout -outform pem > ~/.ssh/TEMP-id_rsa.pub.pem 2>/dev/null echo $PWDHERE > ~/.ssh/TEMP.pwd openssl rsautl -encrypt -pubin -inkey ~/.ssh/TEMP-id_rsa.pub.pem -in ~/.ssh/TEMP.pwd -out ~/.ssh/TEMP.pwd.enc 2>/dev/null rm ~/.ssh/TEMP.pwd > /dev/null 2>&1 # decrypt: PWDHERE=`openssl rsautl -decrypt -inkey ~/.ssh/TEMP-id_rsa.pem -in ~/.ssh/TEMP.pwd.enc`
So.. it would be a very easy task to automate running commands via SSH on servers with the root user on server side (in the end we need to run a script from a desktop machine on server side with root user, but running a command automated would be enough to know, from there we could do the thing..).
BUT: the Question is that how to securely automate running commands with root if we have to "sudo su -" first on the server, and give password in it?
UPDATE: modifying the sudoers file is not an option. (maybe puppet can do this??)
echo myPassword | sudo -S ls /tmp
isn't secure AFAIK. (because if other users 'ps -ef' they could see the pwd for a little time?) So that's not a solution either.
UPDATE#3: I want to do "Remote control a machine(s) with ad-hoc commands"