|
Thank you, Shalom, this is very helpful. Wayne Shalom Carmel wrote:
Almost everything you need is in the redbook about ssh on iseries. http://www.redbooks.ibm.com/redpapers/pdfs/redp4163.pdf To connect as a client to other ssh servers remember thatOn the iseries, the public key of the ssh client is by default in file ~/.ssh/id_rsa.pub The ~ tilde character means the user's home directory. The actual directory is defined by executing CHGUSRPRF user(whoever) HOMEDIR('/somedir/oranother')If the target server is configured by you, then this is important.Copy your id_rsa.pub to a file with a more meaningful name (yourname_ssh_public.key) . If your iseries is called AS400.COMPANY.COM ,and your user name is SHALOM, then the file contains shalom@xxxxxxxxxxxxxxxxx at the end of the line. ssh-rsa B3NzaC1......JLjA7vM= shalom@xxxxxxxxxxxxxxxxxAssuming that the user name on the target system is not SHALOM but BOB, modify the file to include bob@xxxxxxxxxxxxxxxxx instead. ssh-rsa B3NzaC1......JLjA7vM= bob@xxxxxxxxxxxxxxxxxYou have to take the contents of the public key and paste them into a file called ~/.ssh/authorized_keys on the target server.This file is also the home directory, but on the TARGET server. If the target server is not configured by you, then email the file to the server's administrator.To receive the public keys of the server, you have 3 options. 1. When you start an ssh session with a server for the first time, you are prompted to accept and save the server's public key. 2 You can execute the following command in PASE: ssh-keygen targetserver >> ~/.ssh/known_hosts3. You can copy the the public key from the server or receive it by email from the admin, and paste it manually into your ~/.ssh/known_hosts An exaple of copying files automatically from the remote server into your iseries using scpWe want to copy all xml files from the IN directory (inside our homedir) on the remote server , to the /b2b/incoming IFS folder scp -i ~/.ssh/id_rsa bob@targetserver:IN/*.xml /b2b/incomingthe /b2b/incoming folder must exist prior to the copying. An exaple of running an entire sftp script that gets the files and deletes them afterwards We want to copy all xml files from the IN directory (inside our homedir) on the remote server , to the /b2b/incoming IFS folder and delete them from the remote server. create a text file called ssh-input.txt that contains: get IN/*.xml /b2b/incoming rm IN/*.xml exit execute in PASE sftp -b ssh-input.txt bob@targetserverTo run in batch, create a script file b2b.sh that looks like this:#! /QopenSys/bin/sh scp -i ~/.ssh/id_rsa bob@targetserver:IN/*.xml /b2b/incoming exitor like this#! /QopenSys/bin/sh sftp -b ssh-input.txt bob@targetserver exitExecute it viaCALL PGM(QP2SHELL) PARM('b2b.sh') Shalom Carmel ------------------------------------ www.hackingiseries.com
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.