LinuxCommandLibrary

sessreg

Manage user login and logout records

SYNOPSIS

sessreg [-w wtmp-file] [-u utmp-file] [-t timeout] [-x xauthority-file] [-l location] [-n] [-d display] -a username -h hostname -l location|terminal
sessreg [-w wtmp-file] [-u utmp-file] [-t timeout] [-x xauthority-file] [-l location] [-n] [-d display] -r username -h hostname -l location|terminal
sessreg [-w wtmp-file] [-u utmp-file] [-t timeout] [-x xauthority-file] [-l location] -d display -D

PARAMETERS

-w wtmp-file
    Specifies the wtmp file to use for session tracking. Defaults to /var/log/wtmp.

-u utmp-file
    Specifies the utmp file to use for session tracking. Defaults to /var/run/utmp.

-t timeout
    Sets the timeout (in seconds) after which the session is considered inactive. Not commonly used.

-x xauthority-file
    Specifies the X authority file to use. Generally not needed and rarely used, especially on modern Linux systems that handle this automatically.

-l location
    Specifies the location or terminal associated with the session. Crucial for correctly identifying the session's origin.

-n
    Do not update the wtmp file.

-d display
    Specifies the X display associated with the session. Required for deleting the session (-D option).

-a username
    Adds a new session entry for the given username.

-r username
    Removes an existing session entry for the given username.

-h hostname
    Specifies the hostname associated with the session.

-D
    Deletes an existing session entry based on the specified display using -d. Must have the -d option.

DESCRIPTION

sessreg is a simple utility that manages session registration records, primarily for use with window managers like X Window System. It can create, update, and delete session entries in a registration database. These entries typically store information such as the session's ID, user, and terminal. It's often used in conjunction with display managers (like XDM or LightDM) to manage user sessions and their associated resources. It allows you to register a session into the /var/run/utmp and /var/log/wtmp files to register the current terminal/pty as being used.

CAVEATS

sessreg requires root privileges to modify the utmp and wtmp files. Incorrect usage can corrupt these files or lead to inaccurate session tracking. Modern display managers often handle session registration automatically, making direct use of sessreg less common.

EXAMPLES

Add a session for user 'john' on terminal '/dev/tty7' from hostname 'myhost':
sessreg -a john -h myhost -l /dev/tty7

Remove a session for user 'jane' on terminal '/dev/pts/3' from hostname 'anotherhost':
sessreg -r jane -h anotherhost -l /dev/pts/3

Delete the utmp entry of display :0:
sessreg -d :0 -D

HISTORY

sessreg was originally developed as part of the X Window System to provide a standardized way to manage user sessions and track login/logout activity. It was designed to work in conjunction with display managers and other system utilities. Its use has diminished as display managers have integrated session management functionality.

SEE ALSO

utmp(5), wtmp(5), login(1), xdm(1)

Copied to clipboard