The thing is that each command that you execute via system or backticks (`) is executed within it's own shell. So, when you execute your su - dba, it will execute that and start up a shell under the dba account (assuming that it's not prompting for a password). Once this happens, the shell will recognize that it's being called non-interactively and exit immediately. You might want to take a look at sudo. sudo allows you to specify the commands to run in the invocation (i.e. sudo -u dba your_command_here). There's a little more setup on the front end, but a lot better security on the back end.