How to SU - in a script with password ? - TechRepublic
General discussion
October 31, 2002 at 12:47 AM
jeffreymangan

How to SU – in a script with password ?

by jeffreymangan . Updated 23 years, 4 months ago

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.

This discussion is locked

All Comments