# Exit to user from SU in bash script



## daBee (Apr 7, 2017)

Is there a way I can initiate a script as root, then exit to my normal admin user (sudoers) to accomplish further tasks as the user?  I tried `exit` but the script stopped completely.  Things like RVM like to be installed using the user.


----------



## puppyboy (Apr 7, 2017)

You could start a second script from inside the first using `su - username -c /path/to/second/script.sh`. Or just use `su - username -c command` to execute the commands inside the script.

Besides that, I don't know.


----------



## daBee (Apr 7, 2017)

Sounds like a solution.  I was surprised to see that it didn't exit to the original initiator of the shell.


----------

