How do I “su – username” within a shell script and pass the username’s password to complete the su?
For example, I am Bob and I want to give Jack a script that will su – Bob so he or anyone can cancel my print jobs.
My script should:
Enter Printer Name:
read printer
then I need to su – bob
cancel -a $printer
then end su and exit script
But the script will break to ask for bob’s password.
I do not have root access therefore can not su – root in the script.
So to re-cap I want to write scripts that users can use that will allow them to become me temporarily to run or cancel jobs as me.