1826203 Members
2968 Online
109691 Solutions
New Discussion

automated sftp

 
PVR
Valued Contributor

automated sftp

Hi !

We use a ftp script as given below to automate some file transfer from a unix server to a windows server;

ftp -v -n <
Don't give up. Try till success...
13 REPLIES 13
Steven E. Protter
Exalted Contributor

Re: automated sftp

shalom,

Its almost exactly the same

sftp user@hostname >>EOF
password
cd
put file
bye

EOF


You might also try:

sftp -b batchfile user@host

Or set up password free public key exhange and simply use scp to do the job without a password.

http://www.hpux.ws/?p=10

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
PVR
Valued Contributor

Re: automated sftp

Hi SEP

Thanks for the quick response.

But the script is not working. When I execute the script it is prompting me to enter the password. If I enter password, rest things are working fine.

Are you sure that it is working for you at your place ?

Thanks
Don't give up. Try till success...
PVR
Valued Contributor

Re: automated sftp

Can anyone help me to enable ssh password free access from a HP-UX box to a windows XP server ?
Don't give up. Try till success...
Steven Schweda
Honored Contributor

Re: automated sftp

> Can anyone help me [...]

Have you set up public-key pairs yet (as
already suggested)?
Jon M Zellhoefer
Valued Contributor

Re: automated sftp

You can also try using an expect script to do the transfer. I had to set this up at another hospital I worked at. There is an expect recorder that you can use to create a baseline script and edit it as needed. You'll essentially end up manually walking through one sftp session completely, and then modifying the script to either read in a list of files to transfer or something of the sort. It's basically TCL/TK, so if you're familiar, the setup is quite easy.
fsumair_1
Advisor

Re: automated sftp

Hi, Use this it is tested.

ftp -i â n <user
mkdir /test
cd test
lcd /data2/ME/ME_DATA/
mput Date*.DAT
ENDFTP



Regards
Sam
fsumair_1
Advisor

Re: automated sftp

Sorry I thought you are asking about ftp..

As far I know I tried to do the sam from sftp from a script that is succesfully runnig on a linux machine but cannot done in HP-UX.
OldSchool
Honored Contributor

Re: automated sftp

set up key pairs and it will work, you need to place the public key from the unix box in the authorized keys file on the windows machine
Deepak Kr
Respected Contributor

Re: automated sftp

yes, solution here is to set a passwordfree sftp connection from unix box to wintel box.

steps:

1. Generate keypair at unix box using keygen
2. provide the public key pair to wintel guys
3. wintel guys will update key pair.
4. You will be initiating sftp connection request as following

sftp localuser "domainname\remoteuser"@wintelmachine_name

Refer to this doc...

http://www.astro.caltech.edu/~mbonati/WIRC/manual/DATARED/setting_up_no-password_ssh.html

same for sftp also..



"There is always some scope for improvement"
PVR
Valued Contributor

Re: automated sftp

Sorry for the late reply.

I created keypair. May I know the location of authorized_key file in windows servers ?

From windows to unix server, passwordless copy is working fine. But the reverse is not happening. I think the location of my authorized_key file is wrong.

Thanks
Don't give up. Try till success...
Deepak Kr
Respected Contributor

Re: automated sftp

it should be in

path=...\sftp\username\.ssh directory

"There is always some scope for improvement"
Rasheed Tamton
Honored Contributor

Re: automated sftp

Hi,

If it is windows xp, then the best way is to install cygwin on it and do a passwordless sftp as you would do from any unix box to another one.

As far as I know, this is the only way to get the passwordless ssh/sftp to work on windows xp. Otherwise, it would always ask for the passwd.

Regards.
Rasheed Tamton
Honored Contributor

Re: automated sftp

You can get Cygwin here:

http://cygwin.com/

rgds.