sudo

Shell

sudo -s

User

To run the deploy.sh command as the hg user:

sudo -u hg ./deploy.sh

To become the user:

sudo -i -u web

-i

runs the shell specified by the password database entry of the target user as a login shell.