The Sessions tab provides a way to manage current connections.
If enabled, session management allows you to view and disconnect users that are connected to the SSH server.
The sessions tab contains a list of currently connected clients. This list consists of the connected client's IP Address, logged in Username, and the amount of time they have been connected. This tab also contains the ability to disconnect selected users from the server.
This functionality can be enabled and disabled using the Enable Sessions Management checkbox.
SSH Admin Service
When running the server as a service a special SSH administration service is hosted on port 8122 (default). This is exposed as a way for the user application (UI running in the system tray) to communicate with the SSH process that is actually accepting connections. The use of this service is transparent to you as the user. You do not need to take any special steps to use this, it is handled by the application.
You may optionally connect to this service directly using the AdminServiceUser and AdminServicePassword credentials defined in the registry to manually manage sessions.
The SSH administration service is only used for session management functionality and is only accessible from the local machine by default. Additionally it restricts the available commands to only those used for session management. The following Registry Keys settings define the SSH administration service configuration:
- AdminCommandRegex: A regular expression that defines what commands are allowed in the admin service. The default value restricts commands to those listed below. The default value is
^(Get-PSSConnections|Disconnect-PSSClient -ConnectionId \d+|Start-SSHDaemon|Stop-SSHDaemon|Restart-SSHDaemon|Stop-PowerShellServer|Exit)$
- AdminServicePort: The port on which the SSH admin service listens. The default is 8122.
- AdminServiceUser: A username specifically for accessing the SSH admin service. The default is randomly generated during setup.
- AdminServicePassword: A corresponding password specifically for accessing the SSH admin service. The default is randomly generated during setup.
- AdminLocalOnly: Controls whether the SSH admin service is accessible remotely. The default is 1 (True).
By default, only the following commands are allowed when connected to the SSH administration service:
- Disconnect-PSSClient -ConnectionId <Id>
If a command is entered which does not match the RegEx defined by AdminCommandRegex an error is reported.
The Get-PSSConnections cmdlet will return one object for each connection. The properties of the object include ConnectionId, ConnectionTime (as a TimeSpan), IPAddress, and User. For instance:
PS C:\ProgramData> Get-PSSConnections ConnectionId ConnectionTime IPAddress User ------------ -------------- --------- -------- 12547953 00:00:35.4295000 127.0.0.1 machine\user1 11429296 00:00:22.5110000 127.0.0.1 machine\user2