Sudo a command on behalf of another user

passwordsusudousers

I'm using drupal and Aegir. Aegir automates many tasks of site creation. Aegir has control of Apache, I'm logen in as root, and I want to restart the Apache server, but I want to do it on Aegirs behalf. Unfortunately I do not know the Aegir password, so basically I'm wondering how to sudo something as another user.

Best Answer

sudo -u <username> <command>

sudo accepts a user parameter, which will run it as that user.

Alternatively, since you are root:

su <username> -c <command>
Related Topic