I followed a tutorial to install Hudson server. In the tutorial was the following Linux command (
hudson is a username in Ubuntu):
sudo -Hiu hudson
sudo -Hiu for? What happens after I execute this command?
migrated from stackoverflow.com May 9 '12 at 11:27
This question came from our site for professional and enthusiast programmers.
You can type
Hit k/j to scroll up and down.
Hit q to quit.
The -Hiu flag is a combination of the -H, -i, and -u options. Straight out of "man sudo":
So what does all this mean? The first useful option is -u, which causes the command (in this case, the shell) to run as user hudson rather than as user root. The -H option makes the home directory equal to hudon's home directory for the duration of the command, and the -i option says to simulate initial login (e.g. source dotfiles) for user hudson. Taken together, these mean: make the command run under user hudson. Since the command in this case is the shell, this means to open a shell as user hudson, just as if you had logged in as user hudson directly.
As a side note: don't use sudo unless you know which command you're running. If you aren't careful, sudo gives you many more opportunities to mess up your system configuration than you have otherwise. That's not to say that you can't fix it, but taking 5 minutes to read the man pages can save hours of fixing problems later.