Skip to content

io.systemd.Login

APIs for managing login sessions.

Property Value
Go package github.com/rossedman/sdvarlink/systemd/latest/login
Socket /run/systemd/io.systemd.Login
Available since systemd v258
Methods · types · errors 2 · 3 · 7

Methods

CreateSession

Allocates a new session.

func (c *Client) CreateSession(ctx context.Context, in CreateSessionIn) (*CreateSessionOut, error)

Parameters

Field Type Description
UID int Numeric UNIX UID of the user this session shall be owned by
PID ?ProcessId Process that shall become the leader of the session. If null defaults to the IPC client.
Service ?string PAM service name of the program requesting the session
Type SessionType The type of the session
Class SessionClass The class of the session
Desktop ?string An identifier for the chosen desktop
Seat ?string The name of the seat to assign this session to
VTNr ?int The virtual terminal number to assign this session to
TTY ?string The TTY device to assign this session to, if applicable
Display ?string The X11 display for this session
Remote ?bool If true this is a remote session
RemoteUser ?string User name on the remote site, if known
RemoteHost ?string Host name of the remote host
ExtraDeviceAccess ?[]string List of additional hardware devices that this session is granted access to.For every $ID in the list, this adds access for all devices tagged with "xaccess-$ID" in udev.

Reply

Field Type Description
Id string The identifier string of the session of the user.
RuntimePath string The runtime path ($XDG_RUNTIME_DIR) of the user.
UID int The original UID of this session.
Seat ?string The seat this session has been assigned to
VTNr ?int The virtual terminal number the session has been assigned to
Type SessionType The assigned session type
Class SessionClass The assigned session class

ReleaseSession

Releases an existing session. Currently, will be refuses unless originating from the session to release itself.

func (c *Client) ReleaseSession(ctx context.Context, in ReleaseSessionIn) error

Parameters

Field Type Description
Id ?string The identifier string of the session to release. If unspecified or 'self', will return the callers session.

Types

SessionType

Various types of sessions

Value Description
unspecified
tty
x11
wayland
mir
web

SessionClass

Various classes of sessions

Value Description
user Regular user sessions
user_early Session of the root user that shall be open for login from earliest moment on, and not be delayed for /run/nologin
user_incomplete Regular user session whose home directory is not available right now, but will be later, at which point the session class can be upgraded to 'user'
user_light A user session that doesn't pull in the per-user service manager
user_early_light The combination of user_early and user_light
greeter Display manager greeter screen used for login
lock_screen Similar, but a a lock screen
background Background session (that has no TTY, VT, Seat)
background_light Similar, but for which no service manager is invoked
manager The special session of the service manager
manager_early The special session of the service manager for the root user

ProcessId

Process identifier

Field Type Description
pid int Numeric UNIX PID value
pidfdId ?int 64bit inode number of pidfd if known
bootId ?string Boot ID of the system the inode number belongs to

Errors

Error Go type Description
NoSuchSession NoSuchSessionError No session by this name found
NoSuchSeat NoSuchSeatError No seat by this name found
AlreadySessionMember AlreadySessionMemberError Process already member of a session
VirtualTerminalAlreadyTaken VirtualTerminalAlreadyTakenError The specified virtual terminal (VT) is already taken by another session
TooManySessions TooManySessionsError Maximum number of sessions reached
UnitAllocationFailed UnitAllocationFailedError Failed to allocate a unit for the session
NoSessionPIDFD NoSessionPIDFDError The session leader process does not have a pidfd