Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

korn shell script

Status
Not open for further replies.

free1bsd2

Technical User
Aug 28, 2003
1
0
0
US
Where can I find specific info. on creating a korn shell script that would allow me to transfer a file from AIX 4.3.3 to WinXP Pro server across our LAN, and use OpenSSH in the process?

My web searches have turned up little on this specific topic.

Thank you.
 

Hi,

Unfortunately you won't find too much on this. We encountered this problem at my work and this is what I came up with. (Again "correct" solution depends on what your needs are)

PROBLEM: Need to transfer files via FTP from a machine A to another (machine B) using SSH protocols.

SOLUTION:
Created an FTP script to grab all the files to a local directory.
I assume you don't need this part since you
must already have the file local.

Created a combination ksh/autoexpect script using SCP as the SSH transfer program to put the files on the server.
When you use SSH/SCP/SFTP you unless you have
"authentication" protocols set correctly you will
always be asked to enter a password/username.

The autoexpect language basically replays the keystrokes
you enter on the terminal. The autoexpect script then
basically is executing the following command:
scp *.dat machinename:/target_dir
but when the server asks for a password the autoexpect
script will feed the password in too.

If you don't need to use SSH type transfers/connections, I suggest a simple FTP script instead. It's less secure but if you are in a trusted environment it may be the way to go.

 
I mean you're speaking about SFTP.
I hope they are already installed and working on both the system (Unix and XP).
To prevent the user validation request you have to run ftp with the "-n" flag
So you can put the ftp command in a file and run it like:
sftp -n host <<EOF
USER username
PASS user_passwd
CD remote_dir
PUT local_file remote_file
QUIT
QUIT
QUIT
EOF

You have to make some attempts, because some ftp server require a different syntax for the user validation and your command file could look like
sftp -n host << EOF
USER username user_passwd
CD remote_dir
PUT local_file remote_file
QUIT
QUIT
QUIT
EOF
The only problem with this solution is userpassword clearly written in a file
.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top