Networking

Unix and Linux network configuration. Multiple network interfaces. Bridged NICs. High-availability network configurations.

Applications

Reviews of latest Unix and Linux software. Helpful tips for application support admins. Automating application support.

Data

Disk partitioning, filesystems, directories, and files. Volume management, logical volumes, HA filesystems. Backups and disaster recovery.

Monitoring

Distributed server monitoring. Server performance and capacity planning. Monitoring applications, network status and user activity.

Commands & Shells

Cool Unix shell commands and options. Command-line tools and application. Things every Unix sysadmin needs to know.

Home » Commands & Shells, Networking

Adding and Removing sshd instances on CentOS 7

Submitted by on June 20, 2019 – 11:09 am

As a follow-up to my previous post about adding sshd instances on CentOS 5 & 6, here’s a script that does the same on RHEL/CentOS 7.

The script still checks for iptables and if it is active, will add a rule to accept connections. Why not firewalld, you ask? Because it’s an abomination and, if you’re using it, you should be ashamed of yourself.

The del script will prompt you for the sshd instance name to disable and delete.

You can download the add script here and the del script here.

Sample output of add script

[root@ncc1711]# /var/adm/bin/sshd_new_instance_rhel7.sh
Name the new sshd instance: sync
Specify the port for sshd-sync: 22222
sshd-sync is active:
COMMAND     PID USER   FD   TYPE   DEVICE SIZE/OFF NODE NAME
sshd-sync 11790 root    3u  IPv4 57825801      0t0  TCP *:22222 (LISTEN)
sshd-sync 11790 root    4u  IPv6 57825803      0t0  TCP *:22222 (LISTEN)

Sample output of del script

[root@ncc1711]# /var/adm/bin/sshd_del_instance_rhel7.sh
Name the sshd instance to delete: sync
sshd-sync is off
# Generated by iptables-save v1.4.21 on Wed Apr  3 09:35:45 2019
*filter
:INPUT ACCEPT [3798:344109]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [3293:2634398]
COMMIT
# Completed on Wed Apr  3 09:35:45 2019

Print Friendly, PDF & Email

Leave a Reply