Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google site



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

Closed Thread
English Japanese Spanish French German Portuguese Italian Powered by Powered by Google
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 08-14-2009
Registered User
 

Join Date: Jul 2009
Posts: 20
sftp command

Hello folks
i want to know hoaw can i automate sftp command.
When i am execute the script it sftp connect to host and ask for the password but i want password also to be supplied in batfile .It should not ask password on console .

sftp -b batfile user@hostip
Sponsored Links
  #2 (permalink)  
Old 08-14-2009
...@...
 

Join Date: Feb 2004
Location: NM
Posts: 6,172
Here is how to do it:
sftp runs under ssh, so you need to get ssh passwordless connections going:
ssh-keygen: password-less SSH login
  #3 (permalink)  
Old 08-14-2009
Registered User
 

Join Date: Jul 2009
Posts: 20
Quote:
Originally Posted by jim mcnamara View Post
Here is how to do it:
sftp runs under ssh, so you need to get ssh passwordless connections going:
ssh-keygen: password-less SSH login

Hello
Cant it be possibe that it can automaticaly read the password from the batfile and than connect
  #4 (permalink)  
Old 08-14-2009
...@...
 

Join Date: Feb 2004
Location: NM
Posts: 6,172
ssh keys provide passwordless access. ssh is NOT designed to allow -b to have a password in the batch file. As you leanred. You can probably find a workaround by writing a daemon with controlling terminal, but why do that? ssh has keyts for the purpose.

IF this does not suit you use ftp, It does allows passwords in a script.

The reason for this - hardcoded passwords are a major security problem.
  #5 (permalink)  
Old 08-14-2009
fpmurphy's Avatar
Moderator
 

Join Date: Dec 2003
Location: Florida
Posts: 2,101
Have a look a lftp. It supports fully scripted sftp sessions using SSH.
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to use SFTP from command line without entering user and password Hangman2 UNIX for Advanced & Expert Users 7 03-07-2009 03:22 AM
Specify password in SFTP command shabu Security 3 10-10-2008 08:19 AM
sftp command for file transfer mohanpadamata UNIX for Advanced & Expert Users 2 06-12-2008 10:45 AM
How to get the exit satus of a command which I executed in sftp prompt Karteek Shell Programming and Scripting 2 04-09-2008 09:00 AM
Command ignored after sftp - korn shell alienET Shell Programming and Scripting 1 03-24-2005 05:06 PM



All times are GMT -4. The time now is 09:35 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2010. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0