In general most sysadmins would configure things so that their automation does not rely on passwords.
SSH
For SSH authentication the easiest is to create a key-pair where the private key is not password protected.
If you need a passphrase on the private SSH key, adding that key / passphrase to ssh-agent (or a Mac OSX keychain) is a one-off action after which so you won't need to be prompted for the passphrase anymore.
If that is not an option, use sshpass
in your scripts/commands use a password/passphrase from the command line
On the server
Again the easiest/conventional solution is to prevent having to enter a password.
Your options for that depend on the level of control you have
set up a NOPASSWD sudo policy (ideally only for the relevant command(s)) which will allow you to execute sudo some-command --with args
or sudo -i
for an interactive login session without entering a passphrase.
set up the root account for direct remote ssh logins (not the best solution, but when you don't allow password auth, only key based auth...)
depending on the set-up simply add your account to a "sudo" , "wheel" or "admin" group and you get full admin rights
When you really want to submit a password, expect
is the utility for automating that