Solved

SFTP

Posted on 2012-03-22
3
568 Views
Last Modified: 2012-04-09
Hello,
  I would like to know how to pass a password for a sftp routine,

I am sending a file using sftp and need to send the password.  The $PASS does not work and I am not sure how this is done.  When I run my script, it asks for a password that I need to type for the script to continue.  Thanks.

ftp_the_file()
{
sftp -oport=22 $USER@$NODE 2>$ftp_message_file 1>&2 <<EOF
$PASS
cd $DIRECTORY
get $NEW_FILE $NEW_FILE
rm $NEW_FILE
bye
EOF
}
0
Comment
Question by:bje
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 1

Expert Comment

by:DrMadAxe
ID: 37755295
maybe another script to post to that form? IDK What are you trying to do ultimately? upload a file securely or send a form securely?
0
 

Author Comment

by:bje
ID: 37758718
upload a file securely
0
 
LVL 6

Accepted Solution

by:
eksatx earned 500 total points
ID: 37759400
I recommend using sshpass.

sshpass -e sftp -oBatchMode=no -b -p 'my_password' - my_user_name@server_url << !
   put file_to_upload
   bye
!

Open in new window


Here is an article with some more info on sshpass: http://www.cyberciti.biz/faq/noninteractive-shell-script-ssh-password-provider/
0

Featured Post

Transaction Monitoring Vs. Real User Monitoring

Synthetic Transaction Monitoring Vs. Real User Monitoring: When To Use Each Approach? In this article, we will discuss two major monitoring approaches: Synthetic Transaction and Real User Monitoring.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
Starting up a Project

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question