Setting up SSH for IBMi #Gotchas

Tired of using CALL QP2TERM and STRQSH and trying to run SSH?  Here’s some tips that may help:

Connect to your IBMi via ssh client

ssh -X username@ibminame

After entering the password to your SSH connection to the IBMi if you get this error:
Permission denied, please try again.

You need to add the following to the end of sshd_config file because there’s an 8 character limit on username and password until this is in the sshd_config file

ibmpaseforienv PASE_USRGRP_LIMITED=N

Note: that if your username is longer than 8 characters it won’t display and instead “I have no name! ” will display

If you have bash installed you can set it as your default shell by adding this to sshd_config (How to setup bash)

#or uncomment the line below if you want zshell

Note: The change above will globally effect all ssh connections. If your using chroot, the chrooted environment will need (/QOpenSys/opt/freeware/bin/bash) in its rooted directory or ssh will fail

Alternatively you can add this to your .profile in the home directory so that bash will automatically be started

if [ $? != 0 -a "$SHELL" != "/QOpenSys/usr/bin/bash" ]
exec /usr/bin/bash -login

Setting up SSHD host on IBMi

1. Edit your ssh config and enable “ForwardX11 yes“. You can either edit via FTP, WRKLNK etc..  yes is case sensitive

2. End and Start SSH on the IBMi run this command on the 5250. Note: the sshd_config is only loaded once when you start the server, so changes won’t get applied until a restart


Ok, i’ve SSH’d into the IBMi  NOW What?  View what you can do w/ SSH on IBMi here!

Add this line to enable SFTP

Subsystem sftp /QOpenSys/QIBM/ProdData/SC1/OpenSSH/openssh-4.7p1/libexec/sftp-server

If you ever get the messages below it’s probably because SSH is not running

Connecting to USERNAME@MYIBMI…
Loading NaCl plugin… done.
ssh: connect to host MYIBMI port 22: Connection refused
NaCl plugin exited with status code 255.


Man Page for SSHD with various settings you can use –

2 thoughts on “Setting up SSH for IBMi #Gotchas

  1. Pingback: Quick and Simple way to install Bash on IBMi w/ local files | Godzilla swallows i5 whole and is still running years later!

  2. Pingback: What can i do with SSH on IBMi? The alternative to QP2TERM AKA “OMGAwful” | Godzilla swallows i5 whole and is still running years later!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s