What I'm looking for: how to create a script that will execute su, provide a password, and let me stay in that new shell.
What I've found on google: lots and lots about how to execute an operation but nothing on how to stay in the shell
What I've got so far which does work, but immediately logs me out of the new shell (this may not even be the right approach, please tell me if it's not):
**********************
#!/usr/bin/expect
set user "<username>"
set pass "<password>"
spawn su - $user
expect {
;Password: {send "$pass\r"; exp_continue};}
**********************
Security concerns: This file lives in a secured directory so no other users (except the sysadmin obviously) can view the file.
Situation: I have to work with over 100 boxes, I can't use my account to perform operations with the applications we have living on them - hence the su, we are suddenly no longer able to log in directly to the application account, our passwords are ridiculously long and this is going to add a lot of unnecessary typing to my and my team's day if I can't get this script to work so I look forward to your suggestions here!