Is it possible to retrieve detailed session information at the command line?

Using ThinLinc’s web administration interface, it is possible to see detailed information about sessions running on each agent. This includes things like the session creation time, client MAC address, session size, and whether anyone is connected to it or not:

In some cases it may be useful to be able to retrieve this information at the command line; for example for use in /opt/thinlinc/etc/xstartup.d scripts which get run at session startup. The tool tl-session-param ships with ThinLinc, and can be used for this purpose. There is even an --eval parameter for assigning the values to a shell variable directly. It can also be used at the command line within a ThinLinc session in order to list parameters associated with that session:

$ tl-session-param -a /
termserv_hostname = tl.example.com
fbsize_x = 1024
fbsize_y = 768
display = 10
session_pid = 4399
agenthost = 127.0.0.1
client_params/
client_ip = 192.168.4.32
connectionstatus = connected
status = normal
sessionstart = 1690345528.7159708
last_connection = 1690416821.4426165
uid = 1001

Running tl-session-param within a session can be useful for support and help desk operations, for example when trying to troubleshoot a session. The output can either be provided by the user, or their session shadowed by an administrator. There is more information available via tl-session-param than there is in the web administration interface, such as the connected client version and smart card capabilities.

Session information can also be retrieved for any session at the server command line (i.e. not inside a ThinLinc session), provided that:

  1. you are running tl-session-param on the same agent as the session you want the data for
  2. you have access to the directory at /var/opt/thinlinc/sessions/<username>/<session_id>
  3. the required shell environment variables TLSESSIONDATA and USER are set correctly

Because sudo tends to sanitize environment variables, it’s normally easier to su into the user account whose session you want the information for, and run the command:

TLSESSIONDATA=/var/opt/thinlinc/sessions/<username>/<session_id> tl-session-param -a /

Or alternatively, as root:

USER=<username> TLSESSIONDATA=/var/opt/thinlinc/sessions/<username>/<session_id> tl-session-param -a /