}

How to Create and Restart SSH in AIX?

Created:

How to restart the SSH service in AIX

The command used to restart SSH in AIX:

``` bash lssrc -s sshd stopsrc -s sshd;startsrc -s sshd


YOu can also try to kill the ssh process with:

 ``` bash
kill -HUP <sshd pid>
 ``` 

# How to create the SSH service in AIX

If you don't have an sshd service you can create one thus.

The first command will create the service. The second will check if it exists and the last one will check again if exists by another lower level method.

``` bash
mkssys -p /usr/sbin/sshd -s sshd -u 0 -a ""-D -f /etc/ssh/sshd_config"" -e /dev/console -i /dev/console -o /dev/console -R -Q -S -f 9 -n 15 -E 20 -G ssh -d -w 20 
lssrc -S -s sshd () 
odmget -q subsysname=sshd SRCsubsys

To start the service at boot, create the file /etc/rc.d/rc2.d/S70sshd with the following contents:

#!/bin/ksh 
# IBM_PROLOG_BEGIN_TAG 
# This is an automatically generated prolog. 
# 
# bos520 src/bos/etc/rc.d/S70lpd.sh 1.2 
# 
# Licensed Materials - Property of IBM 
# 
# Restricted Materials of IBM 
# 
# (C) COPYRIGHT International Business Machines Corp. 2000,2001 
# All Rights Reserved 
# 
# US Government Users Restricted Rights - Use, duplication or 
# disclosure restricted by GSA ADP Schedule Contract with IBM Corp. 
# 
# IBM_PROLOG_END_TAG 

####################################################### 
# name: S70sshd 
# purpose: sample script that start or stop ssh daemon. 
####################################################### 

case ""$1"" in 
start ) 
startsrc -s sshd 
;; 
stop ) 
stopsrc -s sshd 
;; 
* ) 
echo ""Usage: $0 (start | stop)"" 
exit 1 
esac