I've seen several sudo commands that begin as so:

sudo -Hu apache

What is the purpose of the -Hu argument, and how does it pertain to the apache command that follows?

closed as off-topic by Gerald Schneider, peterh, Ward, sebix, Reaces Aug 16 '17 at 20:24

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions on Server Fault must be about managing information technology systems in a business environment. Home and end-user computing questions may be asked on Super User, and questions about development, testing and development tools may be asked on Stack Overflow." – Ward, Reaces
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    (Nearly) all commands and programs come with an online manual, accessed with the man command, that document usage instructions and the available command line options. So please read the fine manual man sudo. – HBruijn Aug 13 '17 at 6:51

sets $HOME to the apache user's home directory, and executes whatever would follow sudo -Hu apache as the apache user.

Ex: sudo -Hu apache ls ~ would execute ls ~ as the apache user with $HOME set to the apache user's home, listing apache's home directory contents

Not the answer you're looking for? Browse other questions tagged or ask your own question.