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. For example, the user alex will be logged into the bash shell when connecting via port 22, and into the ezsh shell when using port 2244.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. For example, the user alex will be logged into the bash shell(/bin/bash) when connecting via port 22, and into the ezsh(/usr/local/bin/ezsh)when using port 2244. 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
When running sshd on multiple ports to assign different shells to a gateway user, the user should be assigned /bin/bash by default. However, after upgrading Ezeelogin, the user's shell will be changed from /bin/bash to /usr/local/bin/ezsh, leading to the error "Invalid subsystem request".
To fix this issue, revert the Ezeelogin user's shell back to /bin/bash.
root@gateway :~# chsh -s /bin/bash ezadmin
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