bash and ssh

The bash Shell

We have included an up to date version of bash ​with PowerRuby which is great to get features like tab completion, command history and other things from an SSH session (not QP2TERM).

Note you need to make sure the SSH server is started.  How do I start the SSH service on IBM i? 

To make use of our version simply do the following:

  1. Open a terminal on your desktop (Windows users can download and use putty)
  2. Type: ssh user@ip_address_of_IBMi
  3. Type: /PowerRuby/oss/bin/bash  (this step is optional as your default shell might already be set to bash.  You can tell based on whether "bash-4.2" prefixes the prompt)

bash-4.2

or putty for Windows:
Putty for Windows

Make bash The Default Shell

In this brief tutorial we will show how to make the PowerRuby bash your system-wide default.  Obviously you should clear this with your system admin to make sure it won't affect anything negatively.

File /QOpenSys/QIBM/UserData/SC1/OpenSSH/openssh-4.7p1/etc/sshd_config stores name-value-pairs of settings for ssh.  You can edit the file with joe** from an existing ssh session or EDTF*** from 5250 green screen.

**$ joe /QOpenSys/QIBM/UserData/SC1/OpenSSH/openssh-4.7p1/etc/sshd_config
*** EDTF '/QOpenSys/QIBM/UserData/SC1/OpenSSH/openssh-4.7p1/etc/sshd_config'

Change the ibmpaseforishell line to look like the following:
ibmpaseforishell=/PowerRuby/oss/bin/bash

After making changes to the sshd_config file you need to restart the SSH server daemon with the following commands:
ENDTCPSVR SERVER(*SSHD)
STRTCPSVR SERVER(*SSHD)

Individual User Shell Default

To set the shell default for an individual user please see this StackOverflow post.


After making changes to the sshd_config file you need to restart the SSH server daemon with the following commands:
ENDTCPSVR SERVER(*SSHD) 
STRTCPSVR SERVER(*SSHD)

Increasing the Shell timeout

Edit the following IFS file if your shell window times out:

/QOpenSys/QIBM/UserData/SC1/OpenSSH/openssh-4.7p1/etc/sshd_config


(Note that the directory name openssh-4.7p1 may be different on your IBMi based on your system's ssh version.)
Search for ClientAliveInterval, remove the pound comment operator ('#') and change the setting equal to the number of seconds you'd like your shell to be open until it automatically closes due to no usage. For example, I set my system to the following to have a timeout of 30 minutes:

ClientAliveInterval 1800


After making changes to the sshd_config file you need to restart the SSH server daemon with the following commands:
ENDTCPSVR SERVER(*SSHD)
STRTCPSVR SERVER(*SSHD)