?
Solved

SFTP

Posted on 2012-03-22
3
Medium Priority
?
576 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 1500 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

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

In this post we will learn different types of Android Layout and some basics of an Android App.
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Simple Linear Regression
Introduction to Processes

762 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