![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| automate Telnet ? | tbeghain | Shell Programming and Scripting | 4 | 06-19-2007 03:09 AM |
| How to automate an FTP process? | ksak | Shell Programming and Scripting | 1 | 10-06-2006 09:45 AM |
| How to automate responses | djp | Shell Programming and Scripting | 2 | 06-07-2005 01:00 PM |
| Automate FTP | CamTu | UNIX for Advanced & Expert Users | 4 | 02-25-2005 06:08 AM |
| automate an ftp job | flowrats | UNIX for Dummies Questions & Answers | 11 | 07-24-2002 05:47 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
|||
|
Hi,
Currently, i am using sftp manully to transfer files between two secure servers. Can anyone provide me a sample shell script which can automate the sftp process? |
| Forum Sponsor | ||
|
|
|
|||
|
Perderabo,
I made few modifcations to your script to incorporate sftp instead of ftp. I am getting the following error $ ./coolFtp.sh $ Warning: tcsetattr failed in ssh_rl_set_tty_modes_for_fd: fd 1: I/O error The script i am using is : HOST=<Ip Address> USER=<user> PASSWD=<pswd> exec 4>&1 sftp >&4 2>&4 |& print -p open $HOST print -p user $USER $PASSWD print -p cd rksample print -p binary print -p lcd print -p lcd rktest print -p put rkftp.txt exit Am i doing anything wrong here? |
|
||||
|
sftp does not support "open" or "user" commands. At least mine does not. I tried the script that you posted. I get a usage statement. This means that my sftp is different than yours and I won't be able to spoonfeed you a answer.
My sftp is unwilling to accept a password via stdin. It seem to open /dev/tty and do a read. I have to arrange for ssh to work without a password. This involved running "ssh-keygen -t rsa". Then I had to copy my ~/.ssh/id_ra.pub file into my .shh/authorized_key2 file on the ftp server. Then on the client system, I ran ssh-agent and used ssh-add to add the new identity. At this point, both ssh and sftp to the ftp server worked without asking for a password. At this point, this script worked: Code:
#! /usr/bin/ksh
exec 4>&1
sftp ${USER}@${HOST} >&4 2>&4 |&
print -p get testfile
print -p bye
wait
exit 0
|
||||
| Google The UNIX and Linux Forums |