Howto switch / chage user id witin a bash script to execute commands in the same script?
Posted
by
a1an
on Super User
See other posts from Super User
or by a1an
Published on 2012-08-30T09:07:04Z
Indexed on
2012/08/30
9:41 UTC
Read the original article
Hit count: 349
Is there a way to switch user identity within a script (executed as root as part of an installation process) to execute some commands without calling an external sctipt, then be back to root to run other commands?
Sort of:
#!/bin/bash
some commands as root
SWITCH_USER_TO user
some commands as user including environment variables checks, without calling an external script
SWITCH_USER_BACK
some other stuff as root, maybe another user id change...
© Super User or respective owner