Using Secure Shell FTP (SFTP)
Before using SFTP with ibi Data Migrator, you need to set up SSH connections without passwords.
For example, if your Server is 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, and then 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 be able to 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"
/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 ibi Data Migrator desktop interface, expand the Adapters folder. Then expand the Configured folder. Right-click Delimited File (or Fixed Format File) and click Add Connection. You can now select SFTP as the transfer protocol.
Using SFTP From Windows
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:
- Go to the PuTTY Download Page, download the MSI installer, and run it to install and configure their utilities. Alternatively, download psftp.exe and puttygen.exe to a directory in your PATH.
- Download a private key to your Windows system or generate a new key using puttygen. Save it to a directory of your choice, for example, C:\putty\id_rsa.ppk.
- If necessary, add your public key to ~/.ssh/authorized_keys on the remote server.
- Test the connection from the command line using the following lines:
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:
driveIs the drive on which the private key is saved.userIs your user ID.
remoteIs 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 Server does not receive this prompt.
- In your PATH, create a file called sftp.bat with the following lines:
@echo off psftp -i "drive:\putty\id_rsa.ppk" %1 %4 %5 %6 –batch
where:
driveIs the drive on which the private key is saved.
If your 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.
Using SFTP From Windows
In Windows 10, you can enable and use SSH and SFTP on the Windows platform.
In order to use SFTP with ibi Data Migrator, you need to install OpenSSH and set up secured connections without a password from your Windows machine.
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 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.
Install the SSH Client on Windows
To install the SSH client:
- Procedure
- On your Windows machine, click the Windows Start menu.
- Click Settings to open the Settings window.
- Click Apps and then click Apps & features.
- Click Manage optional features and then click Add a feature.
- Scroll through the list of features and click Open SSH Client to expand the window, and then click Install.
- After the installation is complete, open the System Properties for the machine and click Environment Variables.
The Environment Variables dialog opens.
- In the System Variables section, verify that %SYSTEMROOT%\System32\OpenSSH\ was added to the Path.
Note: You might need to reboot your machine to complete the installation process.
Establish a Secure Password-less SFTP Connection
You can establish an SFTP connection that does not require a password by following these steps:
- Procedure
- On your remote machine ensure that you have the .ssh sub-directory located in the /home/user directory, and an authorized_keys file that will store a public key from your local machine. If the directory and the file do not exist, you need to create them. The following example syntax shows how you can create these files:
/home/user/$ mkdir .ssh /home/user/$ touch .ssh/authorized_keys
- On your local Windows machine ensure that you
have the .ssh sub-directory in the /home/user directory, for example,
C:\Users\userid\.ssh.
To create private and public keys (id_rsa and
id_rsa.pub), enter the following command:
/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.
- Connect to your remote machine and append your public key (content of id_rsa.pub) to the authorized_keys file on the remote machine:
/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.
- Verify the SFTP connection. You should not get prompted for a password.
/home/user/$ sftp remuser@remotemachine Connecting to remote...sftp> quit
Using SFTP From Early Windows Versions
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:
- Go to the PuTTY Download Page, download the MSI installer, and run it to install and configure their utilities. Alternatively, download psftp.exe and puttygen.exe to a directory in your PATH.
- Download a private key to your Windows system or generate a new key using puttygen. Save it to a directory of your choice, for example, C:\putty\id_rsa.ppk.
- If necessary, add your public key to ~/.ssh/authorized_keys on the remote server.
- Test the connection from the command line using the following lines:
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:
driveIs the drive on which the private key is saved.
userIs your user ID.
remoteIs 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 Server does not receive this prompt.
- In your PATH, create a file called sftp.bat with the following lines:
@echo off psftp -i "drive:\putty\id_rsa.ppk" %1 %4 %5 %6 –batch
where:
driveIs the drive on which the private key is saved.
If your Server is running, shut it down and then start it again. You can now configure a connection for a (delimited) file for a remote connection using SFTP.