The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
sftp/scp/ssh script with password as authentication james_falco HP-UX 4 05-27-2009 03:04 PM
Reg sftp in shell script vidhya_vec Shell Programming and Scripting 3 11-26-2008 12:30 AM
SFTP shell script help madankumar Shell Programming and Scripting 1 07-26-2008 09:34 AM
how to give sftp a password in a shell scripit kskywr Shell Programming and Scripting 3 12-14-2006 12:55 AM
Change the password in 30 days in sftp script. rosh0623 UNIX for Advanced & Expert Users 3 08-24-2005 12:39 PM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 01-29-2009
alemat alemat is offline
Registered User
  
 

Join Date: Jan 2009
Posts: 2
SFTP in Shell Script with RSA-KEY or password.

I am trying to SFTP to a couple sites. One has an RSA-KEY that was sent to me. Currently I am running that manually using WinSCP. I would like to set it up as a CRON process on our Linux host (Sun).

Can I use the rsa-key they sent me in any directory or does it need to be placed in a specific directory? Can someone provide an example of a shell script that authenticates using the key and then "puts" the file on the sFTP host?

My other SFTP host doesn't use keys. I have tried several ways to avoid the password prompt during my shell script. Our system doesn't recognize "spawn" when trying to use a batchfile. Here is an example of what I have now:
<snip>
#!/bin/ksh

CURRENT_DIR=`/usr/bin/pwd`
export CURRENT_DIR
ORACLE_SID=$1 ; export ORACLE_SID
ORAENV_ASK=NO ; export ORAENV_ASK
. /usr/local/bin/oraenv
#
#
sqlplus @szre_export.sql
OUT_DIR=/home/me/AXIO
FILEDATE=`date +%Y%m%d%H%M%S`

chmod 666 $OUT_DIR/szre_extract.txt

chmod 666 $OUT_DIR/szre_extract.txt

umask 026


if [ -s $OUT_DIR/szre_extract.txt ]
then
cp $OUT_DIR/szre_extract.txt szremti_extract${FILEDATE}.txt
chmod 666 szre_extract${FILEDATE}.txt

else

exit 0
fi

#!/usr/local/bin/expect
sftp myname@connect2ftp.theirhost.net << end_here
expect "password:"
send "secretpass\n";
interact
put szre_extract${FILEDATE}.txt
quit
end_here

exit
<snip>

I have tried several variations, and it continues to prompt for the password.

I appreciate any help here!
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 04:16 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0