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.
On most Linux systems you should able use the command ssh-copy-id.
For remote, enter the name of your remote (SFTP) server.
/home/user$ ssh-copy-id user@remote /usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/user/.ssh/id_rsa.pub"
Note: If the command ssh-copy-id is not available on your system, use the following command instead:
/home/user$ cat ~/.ssh/id_rsa.pub | ssh user@remote "cat >> ~/.ssh/authorized_keys" user@remote's password: password /home/user$
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.
How to: |
Starting in 2015 and the Windows 10 release, you can enable and use SSH and SFTP on the Windows platform.
In order to use SFTP with DataMigrator, you need to install OpenSSH and set up secured connections without a password from your Windows machine.
Note: Since you are using a local machine, it should be sufficient to only install a client SSH software.
Before following the procedures below, verify if you have SSH integrated on your Windows machine by opening the Command Prompt window and entering ssh.
If you get a response describing usage syntax, then you have SSH enabled on your Windows machine. Otherwise, please see How to Install the SSH Client on Windows.
To ensure that SFTP is integrated with your Windows machine after SSH is enabled, open the Command Prompt window and enter sftp.
To install the SSH client:
The Environment Variables dialog box opens.
Note: You might need to reboot your machine to complete the installation process.
You can establish a SFTP connection that does not require a password by following these steps:
/home/user/$ mkdir .ssh /home/user/$ touch .ssh/authorized_keys
/home/user/$ ssh-keygen -t rsa
You can use all of the default values by pressing the Enter key at the prompts, or enter your preferred values.
/home/user/$ ftp remuser@remotemachine ftp> lcd .ssh ftp> cd .ssh ftp> append id_rsa.pub authorized_keys [ or /home/user/$ cat ~/.ssh/id_rsa.pub | (ssh remuser@remotemachine "cat >> ~/.ssh/authorized_keys") ] ftp> quit /home/user/$ sftp remuser@remotemachine
The last command line may ask you if you want to save the keys permanently. Enter yes when prompted.
/home/user/$ sftp remuser@remotemachine Connecting to remote... sftp> quit
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 |