For SFTP connection - How to give password in UNIX Script (ksh) | Unix Linux Forums | UNIX for Dummies Questions & Answers

  Go Back    


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

For SFTP connection - How to give password in UNIX Script (ksh)

UNIX for Dummies Questions & Answers


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 12-04-2012
Vineeta Nigam Vineeta Nigam is offline
Registered User
 
Join Date: Nov 2012
Last Activity: 9 December 2012, 3:52 PM EST
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Error For SFTP connection - How to give password in UNIX Script (ksh)

Hi,

I am not able to give the password in Unix script for SFTP connection.

When I am trying to manully SFTP command for accessing the server , it asking for pwd and I could provide the pwd but I am not getting how to provide the pwd inside the Unix script.


Code:
sftp -v user@xyz.com.

This command is working but how to pass password for connecting the server via Unix bash script.


Below is the script:


Code:
#!/usr/bin/ksh
INGXDIR=/dev
# FTP to Vital
echo "Connecting to Vital...."
 sftp -v bcb@fxyz.com << EOF_FTP
cd $INGXDIR
binary
mput NewWdir.zip
bye
EOF_FTP

Please let me know how to give Password for this SFTP connection in Script.

Please reply me asap. Its very urgent.

Thanks,
Vineeta

Last edited by Scott; 12-04-2012 at 11:02 AM.. Reason: Please use code tags
Sponsored Links
    #2  
Old 12-04-2012
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
 
Join Date: Feb 2004
Last Activity: 23 November 2014, 6:38 PM EST
Location: NM
Posts: 10,280
Thanks: 287
Thanked 814 Times in 756 Posts
The best way is to create ssh keys, then sftp beomes passwordless, which is how it was intended to work.

ssh-keygen: password-less SSH login
Sponsored Links
    #3  
Old 12-04-2012
Vineeta Nigam Vineeta Nigam is offline
Registered User
 
Join Date: Nov 2012
Last Activity: 9 December 2012, 3:52 PM EST
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
For SFTP connection - How to give password in UNIX Script (ksh)

Hi,

Could you please explain me how to establish the Key between two server.

Need step information which i need to follow.
My server : abc

Vital server :xyz

Please let me know how to access the xyz server by SSH key.

Notes :We don't have any other option to pass the pwd in Unix script.
Please reply me .

Thanks
Vineeta
    #4  
Old 12-04-2012
Corona688 Corona688 is offline Forum Staff  
Mead Rotor
 
Join Date: Aug 2005
Last Activity: 23 November 2014, 5:03 PM EST
Location: Saskatchewan
Posts: 19,912
Thanks: 845
Thanked 3,416 Times in 3,201 Posts
The link contains fairly detailed information.

What step are you stuck on?
Sponsored Links
    #5  
Old 12-04-2012
itkamaraj's Avatar
itkamaraj itkamaraj is offline Forum Advisor  
^Kamaraj^
 
Join Date: Apr 2010
Last Activity: 14 November 2014, 7:56 AM EST
Posts: 3,059
Thanks: 33
Thanked 659 Times in 638 Posts
Ask your unix SA team to install the abc server public keys into xyz server
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
SFTP connection to SSH2 UNIX server krishna87 UNIX for Dummies Questions & Answers 3 02-19-2012 05:16 PM
Password less connection(sftp/ssh) panknil Shell Programming and Scripting 2 11-27-2009 12:04 PM
sftp connection from Unix to windows Renjesh Shell Programming and Scripting 7 09-09-2009 07:22 AM
sftp Connection from Unix to Windows 2003 server using Passphrase vijayin Shell Programming and Scripting 1 09-08-2009 02:07 PM
how to give sftp a password in a shell scripit kskywr Shell Programming and Scripting 3 12-14-2006 12:55 AM



All times are GMT -4. The time now is 02:40 AM.