Skip to Content

run sshd on different ports

Running SSHD on multiple ports to assign different shells to gateway users


Overview: This article explains how to run sshd on multiple ports to assign different shells to a gateway user. By configuring sshd to listen on ports 22 and 2244, users connecting on port 22 get the default bash shell, while users connecting on port 2244 are assigned the ezsh shell. This setup allows Ezeelogin gateway users to choose between logging into a bash shell or an ezsh shell. The default shell for users should be /bin/bash, with the option to enforce switching to ezsh from bash.


In the example below, we will run multiple sshd daemon on different ports. The sshd servers will listen on port 22 and port 2244.   The users connecting on port 22 will be assigned the default port /bin/bash and users connecting to the port 2244 via ssh would be assigned to the ezsh shell. This would enable the Ezeelogin gateway user to have the option to login into a bash shell as well as the ezsh shell. Refer the article to Enforce ssh users to ezsh shell

Note:  The users needs to be assigned the /bin/bash by default. It is possible to enforce users to switch to ezsh from bash and not vice versa.

root@gw:~# vi /etc/ssh/sshd_config

Port 22
Port 2244

Match LocalPort 2244 User ?*

       ForceCommand /usr/local/bin/ezsh

root@gw:~# sshd -t

root@gw:~# service sshd restart


Related Articles

Enforcing ssh login shell for ssh gateway users selectively in sshd_config file

Login into the gateway server as a gateway user with bash shell

Remote server ssh username and password to be prompted in the backend shell