Can sudo be used to always run a specified program as a particular user?
I'd like to always run a particular program (e.g. Eclipse) as the apache user. I used to start this program by changing its launcher to call 'su apache -c "/path/to/eclipse"' rather than '/path/to/eclipse'. (This required me to change the login shell in /etc/passwd from nologin to something like bash.)
As I'm new to sudo, I'm wondering if sudo can be used to specify that anytime /path/to/eclipse is run, that it should automatically be run as the apache user (rather than as the currently logged in user)? I get the impression that sudo might allow for this, but I'm not sure. If it doesn't, what other options do I have for 'elegantly' always running this program when launched as a given user? I find that the launcher method I described above isn't the best, because if for whatever reason I launch it a different way, I have to remember to prefix it with 'su apache'.