sftp automation script not working


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting sftp automation script not working
# 1  
Old 10-24-2011
Data sftp automation script not working

Hi all ,

can any one tell me how to code SFTP automation script ?

I searched lots of forums but i didn't get any useful informationSmilie

I don't want auto Login script > like if u run the script it should automatically login into specific account and etc..

Just i want the following things need to be in done in my script.

manual password entry.
after we enter the password , what ever the commands in shell script will have to execute .

I wrote the code like this >

sftp username@xyz.com
pwd
cd /xyz
get abc.ksh

But after login the command's are not executed , just simply i got prompt for manual entry Smilie

can any one please advise me on this Smilie
# 2  
Old 10-24-2011
Almost exactly same issue is raised in this thread: https://www.unix.com/shell-programmin...t-working.html

I think you can just join the thread - better than two separate threads on same issue, right ? Smilie
# 3  
Old 10-24-2011
Right Smilie thanks for the quick reply
# 4  
Old 10-24-2011
Try this...
Code:
#!/bin/bash
sftp username@xyz.com <<EOF
pwd
cd /xyz
get abc.ksh
EOF

--ahamed
# 5  
Old 10-24-2011
Thanks --ahamed . let me try this code once :

---------- Post updated at 11:30 AM ---------- Previous update was at 10:57 AM ----------

@ahamed
could please advise how to exit from sftp ? commands are executing but sftp connection is not closing after those commands are executed .
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Mget with SFTP is not working

hi Team, I am connecting from one (A) linux server to another(C)/any linux server by sftp on A linux server: sftp userid@C password: mget is Not working fine I am using mget to pull the files. it shows mget as invalid command. But from (B) Linux server to (C) /to Any server Linux... (15 Replies)
Discussion started by: johnsnow
15 Replies

2. Shell Programming and Scripting

Simple sftp script not working - Please help

I have the below sftp script to transfer a file from a linux host(source) to another linux host(target). Public key is already set up in target host and I am able to transfer file using sftp from source to target. But not sure why the below script(ftp_script) is not working. Any help in this... (3 Replies)
Discussion started by: Armaan
3 Replies

3. Red Hat

Sftp command not working

What is wrong with this sftp command being used in one line: sftp /Data/SEmisstn.gz lsmsadit@144.226.213.23:/test/lsms.SEmisstn.gz The ssh key is already setup. The node is valid and i can ssh to it as well as do a manual step by step sftp to the server. However, for some odd reason, i... (10 Replies)
Discussion started by: mrn6430
10 Replies

4. Shell Programming and Scripting

Sftp commands not working in shell script

hi, i am having 2 linux boxes as source and 1 linux box as destination.i want to create a shell script containing code to transfer a csv file from either of the 2 linux boxes (file will be present in just one box, i need to check both the boxes to see which box has the csv file) to 3rd linux box... (1 Reply)
Discussion started by: linuxlearn2013
1 Replies

5. Shell Programming and Scripting

sftp autologin is working but ...

Dears, I am new to linux scripting and I was look for a way to auto login to a server using sftp to download a file. I found one and it is working fine. But i don't know the meaning of <<EOF in the code. Any one explain it to me: #!/bin/sh HOST=yourservername USER=yourusername ... (1 Reply)
Discussion started by: torabi
1 Replies

6. Shell Programming and Scripting

Yet another sftp automation question

Hello, I've read quite a few of the sftp questions and answers on the forum but I believe my situation is slightly different. I need to automate an sftp transfer to a host that requires not only a ssh publickey, but also a password. When I try using sftp in batch mode, supplying a "user... (4 Replies)
Discussion started by: n3llyb0y
4 Replies

7. UNIX for Advanced & Expert Users

SFTP automation with password/passphrase

Hi All, We have a special requirement from our client, we need to automate one of the sftp job with password authentication. I know sftp can be automated with Key authentication, but this is not what I am looking for. Can some body help me, a method like .netrc in FTP automation or like sftp... (6 Replies)
Discussion started by: shihabvk
6 Replies

8. Shell Programming and Scripting

SFTP password automation

I am working on a script to automate and SFTP that I am currently doing to a company that does not allow for a .ssh profile to be created. I have search and read about the -b option and am wondering if i can get some more information about it. I tried to right a file containing the password... (3 Replies)
Discussion started by: jaycheetwood
3 Replies

9. UNIX for Dummies Questions & Answers

sftp not working as cronjob

hi, I have a script that will automatically login into a server and get a file. it is working fine if i run it on a command line. however, when i tried to run it as a cron job, it is not working. what should i do? set timeout -1 spawn /usr/bin/sftp user1@server1 match_max 100000 expect... (3 Replies)
Discussion started by: tungaw2004
3 Replies

10. Shell Programming and Scripting

SFTP not working in cron

Hi, I have a simple script that is trying to put a file that resides on a local machine to a remote machine. It runs fine manually but does not complete when scheduling to run in cron. Here is what the script looks like. Any idea what I am doing wrong here? #!/bin/ksh cd /path sftp... (4 Replies)
Discussion started by: ewilson0265
4 Replies
Login or Register to Ask a Question