I know of at least two options, with one more desirable than the other.
The first option is to make the program you want to run owned by the user you want to run it as, and then set the suid bit in it's permissions (man chmod). Whenever the program is run, it will run with the user id of the program's owner. This can get messy, especially if the program you're trying to run is a basic system utility (like ls, grep, etc.). This is really only an option for programs/scripts you have created yourself. Even then, it's not as clean a solution as below.
Take a look at the sudo package. Sudo will allow a user to execute commands as another user like you're hoping. However, out-of-the-box, it will ask you for the user's password before executing the command. With some tweaking of the configuration/privileges file, you can set it up so that a specific user or group of users need not enter the password to run a specific program. I would highly recommend this rather than the setuid bit above.
|