Topics: |
Before using SFTP with DataMigrator, you need to set up SSH connections without passwords.
For example, if your DataMigrator Server is a on a Linux system called local and you want to retrieve or write files on a server called remote, you should log on to your local system with your user ID, for example, user. Then, you need to generate a key file:
/home/user/$ ssh-keygen -t rsa Generating public/private rsa key pair. Enter file in which to save the key (/home/user/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/user/.ssh/id_rsa. Your public key has been saved in /home/user/.ssh/id_rsa.pub. The key fingerprint is: 10:7d:25:cb:ff:1d:c5:f4:1e:dc:7d:44:20:fd:21:56 home@local /home/user/$
This process creates two files in your .ssh directory: your private key id_rsa and your public key id_rsa.pub. Then, you need to add your public key to the authorized users on the remote server. You can do this using FTP. Enter the name of your remote server for remote.
Note: When you issue the command to create the remote directory (.ssh), it will fail if it already exists. This is not an issue.
/home/user$ ftp remote Connected to remote (172.19.23.42). 220 (vsFTPd 2.2.2) Name (remote:user): 331 Please specify the password. Password: password 230 Login successful. Remote system type is UNIX. Using binary mode to transfer files. ftp> lcd .ssh Local directory now /home/user/.ssh
ftp> mkdir .ssh 257 "/home/user/.ssh" created ftp> cd .ssh 250 Directory successfully changed. ftp> append id_rsa.pub authorized_keys local: id_rsa.pub remote: authorized_keys 227 Entering Passive Mode (172,19,23,42,91,225). 150 Ok to send data. 226 Transfer complete. 223 bytes sent in 4.2e-05 secs (5.2e+03 Kbytes/sec) ftp> quit 221 Goodbye.
You can verify if this worked by using SFTP. You should not get prompted for a password.
/home/user/$ sftp user@remote Connecting to remote... sftp> quit /home/user/$
Your connection is now set up. In the Data Management Console, expand the Adapters folder. Then expand the Configured folder. Right-click Delimited Flat File (or Flat File) and click Add Connection. You can now select SFTP as the transfer protocol.
While Windows does not include an SFTP client program, there are programs available from both open source and commercial sources that implement the protocol.
One free source is PuTTY, which supplies a collection of utilities including a client program (psftp.exe) with similar functionality. They also provide puttygen.exe for generating private or public key pairs and converting an existing private key to a file in their .ppk format.
To use PuTTY's PSFTP:
drive:\> psftp -v -i "drive:\putty\id_rsa.ppk" user@remote Using username "user" The server's host key is not cached in the registry ... Store key in cache? (y/n) y Remote working directory is /home/user psftp> ls psftp> quit
where:
Is your user ID.
Is the name of your remote server.
You should not be prompted for a password or passphrase. However, if you have not previously connected to the server, you will be prompted to store the key in the cache. Reply y and you will not be prompted again. You must do this so that the DataMigrator Server does not receive this prompt.
@echo off psftp -i "drive:\putty\id_rsa.ppk" %1 %4 %5 %6 –batch
where:
If your DataMigrator Server is running, shut it down and then start it again. You can now configure a connection for a (delimited) flat file for a remote connection using SFTP.
WebFOCUS | |
Feedback |