Changing effective user

I would like to give execution rights for a script to one user. (that's the easy part...)
When that user is running the script, I would like the effective user ID to be that of the file-owner. Is this possible?

Yes, try looking up the manpage for chmod. What you want is to set the "sticky bit" on the file.

It may be a little tricky to get the script only executable by only one person and to have it set uid, but it can be done through the use of groups.

In many cases, modern shells will not let you run a script setuid, only a binary...

You might need another way.

Any suggestions from anyone?

It suid bit controls the switch of the effective uid. The sticky bit has nothing to do with it. And modern kernels will ignore the suid and sgid bits when executing scripts.

There is a program called "sudo" that can let a user run a script with another uid's authority. That is what I would recommend. sudo is a public domain program available from various archive sites.

Oops, I got +t and +s mixed up again...
Probably not a good thing to do very often, no?

Does anybody knows were could i find this "sudo" program or could point me on an easy way to execute commands inside a script being a different user.

http://www.courtesan.com/sudo/

If you want to log in to another server within a script (I have a feeling this will be the next question) , and as long as you're not too worried about security, check out http://expect.nist.gov for Expect and samples. Also, search this site for .netrc .

Have fun!