Shell script to transfer file via SFTP | Unix Linux Forums | Shell Programming and Scripting

  Go Back    

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

Shell script to transfer file via SFTP

Shell Programming and Scripting

Closed Thread    
Thread Tools Search this Thread Display Modes
Old 11-15-2012
Kapom Kapom is offline
Registered User
Join Date: Jun 2012
Last Activity: 8 April 2014, 8:20 PM EDT
Posts: 6
Thanks: 2
Thanked 0 Times in 0 Posts
Shell script to transfer file via SFTP

Hi all,

I'm trying to do a script to transfer file between my server and an external server via SFTP protocol. It doesn't use rsa key, but password.

When I run the script, it throw back a prompt that request me to put the password. How should I do for automatic login? Pleaes help

Thanks you in advance

log_file = ./pom_log
sftp -oport=40 $user@$ip << EOF >> $log_file
quote ${pass}

Sponsored Links
Old 11-15-2012
jyoung jyoung is offline
Registered User
Join Date: Nov 2001
Last Activity: 12 May 2014, 12:49 PM EDT
Location: Flint, MI
Posts: 262
Thanks: 0
Thanked 4 Times in 4 Posts
Try searching the forums. There are several answers that you can use.
Sponsored Links
Old 11-15-2012
Corona688 Corona688 is offline Forum Staff  
Mead Rotor
Join Date: Aug 2005
Last Activity: 29 January 2015, 11:59 AM EST
Location: Saskatchewan
Posts: 20,178
Thanks: 862
Thanked 3,504 Times in 3,272 Posts
You should not be trying to inject plaintext passwords into sftp. That it's so difficult to do is actually a subtle hint, writ in mile-high flashing neon letters, that it's a really, really bad idea. Retrievably-stored passwords are almost impossible to keep safe. "Interactive password authentication" means "Password typed by a human being in realtime authentication" and no artificial substitutes for humans are acceptable. It insists on it being input to a terminal.

Use ssh keys, that's what they're there for.
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Problem automating sFTP transfer using script in cron robbien UNIX for Dummies Questions & Answers 6 06-21-2010 04:40 AM
SFTP with ASCII file transfer govindts Shell Programming and Scripting 4 02-18-2009 08:57 PM
sftp file transfer Satyak Shell Programming and Scripting 14 07-17-2008 12:14 PM
sftp command for file transfer mohanpadamata UNIX for Advanced & Expert Users 2 06-12-2008 10:45 AM
How to transfer files (By using generic script) when using sftp gsri Shell Programming and Scripting 0 08-28-2006 10:39 PM

All times are GMT -4. The time now is 02:21 PM.