Unix/Linux Go Back    

Shell Programming and Scripting Unix shell scripting - KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and shell scripts and shell scripting languages here.

Shell script to transfer file via SFTP

Shell Programming and Scripting

Closed Linux or Unix Question    
Thread Tools Search this Thread Display Modes
Old Unix and Linux 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 Linux

Thanks you in advance

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

Sponsored Links
Old Unix and Linux 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 Unix and Linux 11-15-2012
Corona688 Corona688 is offline Forum Staff  
Mead Rotor
Join Date: Aug 2005
Last Activity: 3 November 2015, 12:57 AM EST
Location: Saskatchewan
Posts: 21,164
Thanks: 937
Thanked 3,808 Times in 3,555 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 Linux or Unix Question

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux 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 01:11 AM.