How do you, via a script, specify the password, and a command to run, once an su/sudo/ssh has been executed?

su — password

TODO: figure this out

su — command

su -c command

sudo — password

As long as NOPASSWD is specified in the sudoers file, a password isn't needed.

Otherwise, you can do sudo -S, and pipe the password in to stdin.

(better options are: NOPASSWD; any PAM module, such as pam_ssh_agent_auth)

sudo — command

sudo -u user command

ssh — password

If it's OpenSSH on the client end, you can use the $SSH_ASKPASS trick.

If it's PuTTY on the client end, use -pw.

(better options are: 1) public/private keys, and 2) use ssh-agent)

ssh — command

ssh [user@]hostname command

sshrc !