I'm writing a script that requires root access for HP-UX. I was wondering if there was some way to pass in a password to the su root -c command so that the user would not be prompted for a password.
In this circumstance, I cannot use sudo because the command does not exist in HP-UX. Otherwise, I would use the command
echo $PASSWORD | sudo -S <command requiring root privileges>

sudoand use it. Do NOTechoyour root password, instead configuresudoto not prompt password%users ALL = NOPASSWD: /scripts/rootscript.sh. – Sampo Sarrala Jun 28 '12 at 17:52