How Termius detects the server’s OS How Termius detects the server’s OS

How Termius detects the server’s OS

Dmitry Machulo Dmitry Machulo

To detect the OS installed on a server, Termius executes a script (see below). It happens each time when the connection is being established (in the exec channel). Having found out the OS installed on a server, Termius can display the logo of the OS next to the host name in the interface, instead of a generic icon.

The information about OSes is synchronized across all devices (requires a premium account).

Only the mobile versions of Termius detect OSes. The desktop app doesn’t detect OSes, but it will display OS logos if the OSes were detected in a mobile app and that information was synchronized.

OS detection can be enabled or disabled in the settings. It is enabled by default.

OS detection algorithm

Before Termius executes a script to detect OS, it finds out which shell runs on the server, which is done like so:

echo $SHELL
exit;

If the above script doesn't return an error, Termius runs one of the scripts below, depending on the shell being used on the server.

if set name (uname) = "Linux"
cat /etc/*release
else
uname
end
HISTFILE=;
SA_OS_TYPE="Linux"
REAL_OS_NAME=`uname`
if [ "$REAL_OS_NAME" != "$SA_OS_TYPE" ] ;
then
echo `uname`
else
DISTRIB_ID=\"`cat /etc/*release`\"
echo $DISTRIB_ID;
fi;
exit;

If any of the scripts mentioned in this section returned an error, Termius checks whether or not RouterOS is installed on the server:

:put [/system resource get platform]

Turn OS detection on or off

  1. Go to Settings.
  2. Check or uncheck Detect Host Operating System.
  1. Go to Settings.
  2. Check or uncheck Detect OS.

Add comment

Please sign in to leave a comment.