Solved How can root run a script as another user and get back?

I need to be able as root to cycle through the users, and run a script for each user, as that user. I can su to that user on the command line, and type exit to get back to root. I can do it in a shell script, but when the shell script exits, I still need to type exit to get back. I need to automate it.

Thanks!
 
You can use the -c option to execute something. This could be your script. Something like this:

Code:
su -l someuser -c /path/to/script.sh
 
Back
Top