This document talks about Automating SFTP in AIX 5L:
I First step is to install openssh installed in your Unix server.
(If you already have SSH installed, skip and move to step II)
IBM's openssh software for AIX V5L (e.g. 5.1,5.2 & 5.3) can be downloaded from the following web site:
Select: openssh-aix51 openssh-3.8.1p1_51.tar.Z
Save file openssh-3.8.1p1_51.tar.Z to disk.
There is also a link to the openssl download web site:
Summary: Download latest OpenSSL rpm image. Openssl-0.9.7d-2.aix5.1.ppc.rpm <---works with all releases of AIX 5L
Before using OpenSSH, you will need the OpenSSL cryptographic library on your system. You can download the rpm image for the OpenSSL library from: https://www6.software.ibm.com/dl/aixtbx/aixtbx-i?S_PKG=dlaixww&S_TACT=&S_CMP=(Quick, 3 minute registration is required).
Installing the software: You MUST install the openssl rpm before installing the openssh file set. Use the rpm command to install openssl
To list the installed rpms.
Use smit to install the openssh software: Uncompress and untar the openssh-3.8.1p1_51.tar.Z
- uncompress openssh-3.8.1p1_51.tar.Z
- tar -xvf openssh-3.8.1p1_51.tar
- smitty install_all
(Accept the license agreement for openssh)
After the installation successfully completes it should have started the sshd daemon.
To list the installed openssh software
To check if the sshd daemon is active
To start the sshd daemon if inoperative.
To stop the sshd daemon if needed.
After a successful installation, by default the sshd daemon is configured to start now and on every reboot.
Testing your OpenSSH installation:
II Using sftp in a script (with RSA/DSA Authentication)
To use sftp in a script without user interaction, we will need to set up RSA Authentication and then pass a batch file containing the transfer commands to sftp.
For this explanation, we will assume that the local machine's hostname is machineA, and the remote machine's is machineB. We will also assume that the username of the user who will be doing the sftp is 'sftpuser'. Required user input is denoted by bold monospaced text.
1) Generate RSA key pair and verify that the keys are there
Generating public/private dsa key pair.
Enter file in which to save the key (/home/sftpuser/.ssh/id_rsa): <ENTER> Enter passphrase (empty for no passphrase): <ENTER> Enter same passphrase again: <ENTER> Your identification has been saved in /home/sftpuser/.ssh/id_rsa. Your public key has been saved in /home/sftpuser/.ssh/id_rsa.pub. The key fingerprint is: b7:95:f7:a0:e1:52:01:d5:ec:48:e3:73:f7:45:40:46 sftpuser@machineA
2) Copy the public key to the remote machine
3) Login to remote machine to add key to authorized_keys file
4) Test the Authentication
5) Create batch script to test sftp
6) Test sftp
7) Verify that the file was transferred
You can now use the sftp command, similar to the one in Step 6, in your script.