Well, somebody in this situation needs to have elevated privileges, otherwise, what's the point? Why switch from Dave to Bob if they both have the same privileges?
In any case, the solution is still sudo.
Here's an example... let's say Dave is responsible for the installation and maintenance of a database. The database is going to run under a service account, called dbadmin.
1) Create the dbadmin account.
2) Use the visudo command to edit the /etc/sudoers, giving Dave the rights to execute commands under the dbadmin userid, like so:
Code:
Dave ALL = (dbadmin) ALL
3) Now Dave can execute script.sh under the dbadmin account's rights, as so:
Code:
sudo -u dbadmin script.sh
When you configure sudo, you can set it up so that Dave gets a prompt for either dbadmin's password, or his own.