how i can use sftp in script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting how i can use sftp in script
# 1  
Old 08-31-2012
Data how i can use sftp in script

how i can use sftp in script,

Code:
 
unset LIBPATH
sftp wccuser@10.77.77.77 <<eof1>> /home/wccuser1/wcc/Scripts/bulk_file_ftp/bulk_file_ftp.log
passwordlcd /home/wccuser1/wcc/Scripts/bulk_file_ftp
cd /wcc_cdr01/misuser/wcc/ftp/log_file_ftp/10.77.0.77
mput  *.csv
bye
eof1

while execution it is promting for password , not taking automatically.


PHP Code:
 
+ unset LIBPATH
sftp wccuser1@10.77.77.77 0< /tmp/sh602212.2 1>> /home/wccuser1/wcc/Scripts/bulk_file_ftp/bulk_file_ftp.log
wccuser1
@10.77.0.23's password: 
# 2  
Old 08-31-2012
ssh, and any other sane login system, does not take plaintext passwords from anything but a terminal. "Interactive password authentication" means "Password typed by a human being in realtime authentication" and no artificial substitutes for humans are acceptable. If you redirect into it, it will just open /dev/tty to get your terminal. If no terminal is available, it will simply quit. This is an important security feature; it's nearly impossible to keep retrievably-stored passwords safe.

The proper way is to use noninteractive authentication, which you can do by creating a key on the client and copying it over to the appropriate place on the server. It will try the key first, and if it's accepted, the login will go through automatically and without fuss. See passwordless ssh -- ssh, sftp, and scp all use the exact same login system and keys etc.
This User Gave Thanks to Corona688 For This Post:
# 3  
Old 08-31-2012
k thanks , i will try and let u know in case if it not works.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help with SFTP script

Hi All, I just wanted to write a simple SFTP script. I already referred to plenty of posts before but its of no use. Please dont give me previous posts link for reference. Please comment if you are really interested in solving my issue. 1. I dont want to install SSH key 2. I dont have... (2 Replies)
Discussion started by: Naga06
2 Replies

2. Shell Programming and Scripting

SFTP or scp with password in a batch script without using SSH keys and expect script

Dear All, I have a requirement where I have to SFTP or SCP a file in a batch script. Unfortunately, the destination server setup is such that it doesn't allow for shell command line login. So, I am not able to set up SSH keys. My source server is having issues with Expect. So, unable to use... (5 Replies)
Discussion started by: ss112233
5 Replies

3. Shell Programming and Scripting

Sftp through script

hi, I have a requirement where i need to sftp the file from another server. Let me describe in detail: when i login into putty i use my id i.e. kusvi and then i start another acc i.e.cdram where all development works takes place...so if i am in cdram and i need to do sftp i have to exit... (1 Reply)
Discussion started by: gnnsprapa
1 Replies

4. Shell Programming and Scripting

SFTP Script

Hi All, I'm creating an sftp script that will pull data from sftp server and will also move files to a certain folder. My question is that how will i know if the moving of files were successful, is there a way for me to determine it. Thanks, Reign (1 Reply)
Discussion started by: reignangel2003
1 Replies

5. Shell Programming and Scripting

SFTP-how to log individual sftp command error while executing shell script

Hi, I have situation where i need to automate transferring 10000+ files using sftp. while read line do if ; then echo "-mput /home/student/Desktop/folder/$line/* /cygdrive/e/folder/$line/">>sftpCommand.txt fi done< files.txt sftp -b sftpCommand.txt stu@192.168.2.1 The above... (1 Reply)
Discussion started by: noobrobot
1 Replies

6. UNIX for Dummies Questions & Answers

Script for sftp

Hi, I need a script that automatically connect to a sftp server and send a file. The problem I have is that it need to enter the password. As you might enter the password automatically so it would not ask. Thank you. (7 Replies)
Discussion started by: pepeli30
7 Replies

7. UNIX for Dummies Questions & Answers

sftp script in .sh

Hi, I want download files from Server A to Server B when i want run script. my source server : A my Destination server:B I have to run script in server A only. please help me on this. (2 Replies)
Discussion started by: koti_rama
2 Replies

8. Shell Programming and Scripting

sftp script

I am new to the forum. I need help with writing a unix sftp script that will allow me to put a txt file in the destination server. The destination server is a windows box and when I connect from another windows machine, at the dos prompt I need to Type: ftp<sp> ftp-gw<enter> Type: servername... (2 Replies)
Discussion started by: coburn
2 Replies

9. UNIX for Dummies Questions & Answers

SFTP script

I have this script but it is not working I need help, to transmit a file and rename it. #!/bin/ksh final_file="file name" ftp -nvd IP_address << ENDFTP user username password cd <folder where you want to put the file> bin mput $final_file quit ENDFTP (0 Replies)
Discussion started by: HROMERO
0 Replies

10. Shell Programming and Scripting

sftp through a script

Guys How can I use sftp through a shell script? OR is there is a more secure way to transfer files from one host to another (in a non-secure environment)? Please help. I have tried various options. And I am currently doing the transfer of backups manually, I want to automate this. ... (1 Reply)
Discussion started by: skotapal
1 Replies
Login or Register to Ask a Question