[H-GEN] temporary user change in bash script
Snowy Angelique Maslov
snowy at snowy.org
Sun Apr 8 22:56:44 EDT 2012
On 9/04/2012 12:46 PM, mick wrote:
> [ Humbug *General* list - semi-serious discussions about Humbug and ]
> [ Unix-related topics. Posts from non-subscribed addresses will vanish. ]
> I need run a script as root but change to a different to execute one step in the middle of the script, the return to being root to finish the script.
> I've looked through a couple of bash snippet sites ans Advanced Bash Scripting but can't for the life of me see what I need.
> Can someone please help me
> General mailing list
> General at lists.humbug.org.au
Check out sudo - you can get this to execute whatever you need as that
user for that one step
Something like 'sudo -u <user> <command>' will suffice.
Or you can use 'su' as well. Such as 'su -c <command> <user>'.
Snowy Angelique Maslov<snowy at snowy.org>
More information about the General