![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Rules & FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| shell script to execute user command | redtiger | Shell Programming and Scripting | 1 | 04-30-2008 03:53 PM |
| how to execute a batch script from shell script | lakshmis10 | Shell Programming and Scripting | 1 | 10-17-2007 09:43 AM |
| How to restrict the number of commands user can execute | rockysfr | Shell Programming and Scripting | 1 | 07-03-2007 10:53 AM |
| script execute or no execute | Kespinoza97 | Shell Programming and Scripting | 4 | 06-23-2007 06:27 AM |
| Maint user cannot execute ping command | kabeer_n | UNIX for Dummies Questions & Answers | 3 | 10-23-2006 08:01 PM |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Execute internal script as different user
I have a script that I must run as user X and need to send the results to a different server as user Y (sftp). User Y has been set up to not require password authentication between the 2 servers. I would prefer to keep these in a single script, as our operations might have to run it from time to time and I would prefer to keep things simple.
Another thought was to have 2 scripts that poled a status file to see "whose" turn it was to execute. Any suggestions? Thanks |
| Forum Sponsor | ||
|
|
|
|||
|
Yes, sftp needs to be run as user Y. The main script is a start/stop process for a web based application (separate app and web servers). All the processes must be started or stopped as user X, but user Y must be used to send results to the other server detailing basically whose turn it is to run.
[app server script] start environment (x) start rmi (x) sftp web (y) wait till app continue start scheduler (x) [web server script] wait till web start web (x) sftp app continue (y) |
|
|||
|
Try this
script starts as X script then does SSH to other system as Y using private key as follows... Code:
echo this is running as X here ssh -i identity Y@other <<EOF echo this script part will run as Y on the other machine EOF echo this is back running as X here |