Solved

SFTP

Posted on 2012-03-22
3
549 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
3 Comments
 
LVL 1

Expert Comment

by:DrMadAxe
Comment Utility
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
Comment Utility
upload a file securely
0
 
LVL 6

Accepted Solution

by:
eksatx earned 500 total points
Comment Utility
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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
copyEvens challenge 6 63
mergeTwo  challenge 13 71
mapShare challenge 13 67
eclipse package explorer vs project explorer view 2 27
This article will show, step by step, how to integrate R code into a R Sweave document
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
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…

772 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now