SSH on IBM i

Secure Shell (SSH), a network protocol used every day by software developers, provides a fast, secure means to transfer files and submit commands to remote servers.

Zend Studio 8.0‘s SSH support allows users to save their PHP scripts onto remote servers such as IBM i.

How to set up SSH on IBM i

SSH runs as a server program, the SSH daemon (sshd). Before sshd can run, it requires a set of public/private key pairs.

Instructions for creating the key pairs and starting the server are given below.  There are two versions of instructions, depending on the version of OS.

IBM i v6.1 and higher: one step creates public/private keys (if needed) and starts server

STRTCPSVR *SSHD

V5R3 and V5R4: two steps are required

1. First, create the public/private key pairs (only needs to be done once):

CALL QP2TERM
ssh-keygen -t rsa1 -f /QOpenSys/QIBM/UserData/SC1/OpenSSH/openssh-3.5p1/etc/ssh_host_key -N ""
ssh-keygen -t dsa -f /QOpenSys/QIBM/UserData/SC1/OpenSSH/openssh-3.5p1/etc/ssh_host_dsa_key -N ""
ssh-keygen -t rsa -f /QOpenSys/QIBM/UserData/SC1/OpenSSH/openssh-3.5p1/etc/ssh_host_rsa_key -N ""

2. Then start sshd (“&” means to run in background):

/usr/sbin/sshd &
Either way, the daemon should now be running. To check, type NETSTAT *CNN on an ordinary 5250 command line. Look for a local port called “ssh” or 22.
For more information about setting up SSH, including prerequisites, see this “Young i Professionals” SSH wiki article and this old but still useful SSH article from Zend’s Knowledge Base.
This entry was posted in IBM i, iSeries, PHP, System i, Zend Studio and tagged , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>