I ran into a similar problem when getting "hooks" in subversion to work... The shell script was run as "user1" and I needed it to run as "user2" so I wrote a shell script (owned by "user1") that kicked off a small C program which ran the script I need run by "user2". Something along the lines of: #include <stddef.h> #include <stdlib.h> #include <unistd.h> int main(void) { execl("/home/user1/script", "script", (const char *) NULL); return(EXIT_FAILURE); } * NOTE: I had no success using "exec", it only worked with "execl" Then make the program and the key is the "chmod +s" gcc test.c -o test chown user2:user2 test chmod +s test Obviously there may be security risks with this method! Hope this helps! Michael Z Mike Leo wrote:
I brought this up last night, but the suggestions did not help.
Basically i have a "thing" i need to run at boot as someone else.
init scripts are launched at boot as root, so somewhere in the script, I have to become someone else to execute this "thing".
sample thing:
su -l LNVAPP008SSH -c "/usr/local/bin/ssh2 -p 32497 -R51180:LNVAPP008:80 -l LNVAPP008SSH n2web043"
This works just fine when logged in as root or as the LNVAPP008SSH user from the command line. The ssh has been setup so that this user (LNVAPP008SSH) does not need to pass a password to initiate the ssh tunnel.
However, when this is called from a script, it fails trying to look for a password.
I am surmizing that the script is still acting as root when it makes the ssh connection. When i put a printenv in the script, it reports me as still being root, not the LNVAPP008SSH user.
I also have another situation that I need to apply this too. This seems like it should be something someone else in the world has done before.
So any thoughts on this would be greatly appreciated.
Thanks Mike _______________________________________________ Wlug mailing list Wlug@mail.wlug.org http://mail.wlug.org/mailman/listinfo/wlug