in reply to Running as Another User
Aside from the fact that it's a bad idea to hard code passwords in scripts and that system doesn't return until the process it creates has already exited, su reads a password from its tty (if you're not already root). You'd have to use something like Expect to handle this, but a better solution is to get your sysadmin to configure sudo (and install it if needed) to allow you to run the necessary command(s) as the users in question.
|
|---|