1837765 Members
3627 Online
110119 Solutions
New Discussion

Script for FTP

 
Mohammad Sanaullah
Frequent Advisor

Script for FTP

hi every one for the support through this forum i need a script that i need for logfiles. I need to FTP the files through the cron job to run on Windows Server through the Unix (Solaris 9 ). please anyone who has any related script for the same i have no idea of scripting as i am new on system Administration and this is a task given to me from my senior.

hope will get some good response.

Thanks in Advance
Mohammad Sanaullah
Alive
2 REPLIES 2
Rasheed Tamton
Honored Contributor

Re: Script for FTP

Hi,

# cat /dir/input
/usr/bin/ftp -v -n > /var/tmp/ftpscript.log 2> /var/tmp/ftpscript.err <open servername.domain
user username password
prompt
cd /ddir
bin
mput file*
ls /tmp
quit
EOF

sh /dir/input (run the script input)

Use the above script on the cron. It will give two files in the /var/tmp (error and log) so that you can see what it was doing when the ftp started. The username is the userid for the ftp session and the password is the original passwd.

Regards,
Rasheed Tamton.
Steven E. Protter
Exalted Contributor

Re: Script for FTP

Shalom Mohammad,

Welcome to Systems administration.

The ftp method provided will work but ftp by its design is not secure.

This procedure requires you to hard code a password into a script.

A better solution would be to install openssh secure shell on your Unix server, exchange public keys between these hosts.

If this is done, you will have a secure encrypted authentication, the ability to do the work with cron and no security problems.

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