[sudo-users] Urgent help on sudo in batch mode

Krishna Pinisetty kris.pvg at gmail.com
Fri May 16 23:51:49 EDT 2008


Hi Sudo User Group,

Appreciate any one can provide help on issuse with sudo in a script.

when execute below 3 lines on intertrative mode, it works fine I should able
to get sftp> prompt.

csh
*server_user%* sudo ssh -i /export/home/user/.ssh/dsa_key -N -L 224:xyz:22
user at targetserver <user at targetserver> &
*server_user%* sftp -oIdentityFile=/export/home/user/.ssh/dsa_key -oPort=224
-b /dev/fd/0 user at localhost <user at localhost>

If put below lines in a script *abc.sh*

#!/bin/ksh
IDFILE=/export/home/user/.ssh/dsa_key; export IDFILE
*/bin/csh*
sudo ssh -i $IDFILE -N -L 224:xyz:22 user at targetserver <user at targetserver> &
sftp -oIdentityFile=$IDFILE -oPort=224 -b /dev/fd/0
user at localhost<user at localhost>

When execute sh abc.sh, it is not pormting sftp> , just pormting *
server_user%*
**
*Could you please advise what is the wrong in script ?*
**
*Thanks in advance.*
**
*Regards,*
*Kris*
**



More information about the sudo-users mailing list