×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

sftp file into the target system with encrypted password

sftp file into the target system with encrypted password

sftp file into the target system with encrypted password

(OP)
We are praparing a script to move a file from AIX 6.1 to other system.

we are using the below script"put_etransfer.ksh"
#!/usr/bin/ksh
sftpdate=`date +"%Y%m%d%H%M"`
filename=hsa-selectacc.asc
logfile=/home/data/interfaces/log/etransfer_$sftpdate.log
cd /home/data/usinterfaces/out
if ! -e $FILENAME
then
print "ERROR - $FILENAME does not exist."
print "Exitting ..."
exit 1
fi
/usr/local/bin/sftp -B /home/hrdata/scripts/USsftp/cmdc.sftp qaz00100@move.etransfer.com >> $logfile

here cmdc.sftp conatains below commands
binary
ls -l
put hsa-selectacc.asc
exit
==========================================================
when we execute put_etransfer.ksh we get error message

./put_esecuretransfer.ksh
Error: Could not open connection to `qaz00100@move.etransfer.com': Could not connect to `move.etransfer.com': Disconnected by application
when I change the script to

#!/usr/bin/ksh
sftpdate=`date +"%Y%m%d%H%M"`
FILENAME=hsa-selectacc.asc
logfile=/home/hrdata/usinterfaces/log/etransfer_$sftpdate.log
cd /home/hrdata/usinterfaces/out
if ! -e $FILENAME
then
print "ERROR - $FILENAME does not exist."
print "Exitting ..."
exit 1
fi
sftp qaz00100@move.etransfer.com
and execute the script put_etransfer.ksh
It will ask for password and if I provide the password it will get connected but i need to give the command put hsa-selectacc.asc

Can any one help me on this.

Thanks inadvance
Viswanath

RE: sftp file into the target system with encrypted password

Alright Viswanath try this.

#!/usr/bin/ksh
SFTPDATE=`date +"%m%d%Y"`
FILENAME="hsa-selectacc.asc"
LOGFILE=/home/hrdata/usinterfaces/log/etransfer_$SFTPDATE.log
cd /home/hrdata/usinterfaces/out
if [[ -e $FILENAME ]]
then
sftp qaz00100@move.etransfer.com << EOF
put hsa-selectacc.asc
exit
EOF
print "The File is successfully copied" >> $LOGFILE
else
print "ERROR - $FILENAME does not exist." >> $LOGFILE
print "Exiting ..." >> $LOGFILE
exit 1
fi


Let me know how it goes.

Also you can use ssh key pair for password less authentication. (In this situation you don't even need a password).

SARFARAZ AHMED SYED,
Sr. Systems Engineer

RE: sftp file into the target system with encrypted password

Oh, forgot to add " " on log file

Please make sure you add " " (double quotation)
LOGFILE="/home/hrdata/usinterfaces/log/etransfer_$SFTPDATE.log"

SARFARAZ AHMED SYED,
Sr. Systems Engineer

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close