# AccountsService 22.08.0 Documentation

### Matthias Clasen

`<mclasen@redhat.com>`

Version 22.08.0

# Part I. Reference

# D-Bus API Reference

The AccountsService provides a D-Bus API for programs to obtain information about user accounts that are present on a system.

Please see the other sections of this manual for an introduction to these concepts.

This API is not yet stable and is likely to change in the future.

## Name

org.freedesktop.Accounts — Accounts interface

## Methods

    ListCachedUsers (out 'ao' users)
    FindUserById    (in  'x'  id,
                     out 'o'  user)
    FindUserByName  (in  's'  name,
                     out 'o'  user)
    CreateUser      (in  's'  name,
                     in  's'  fullname,
                     out 'o'  user,
                     in  'i'  accountType)
    CacheUser       (in  's'  name,
                     out 'o'  user)
    UncacheUser     (in  's'  name)
    DeleteUser      (in  'x'  id,
                     in  'b'  removeFiles)

## Signals

    UserAdded   ('o' user)
    UserDeleted ('o' user)

## Implemented Interfaces

Objects implementing org.freedesktop.Accounts also implements org.freedesktop.DBus.Introspectable, org.freedesktop.DBus.Properties

## Properties

    'DaemonVersion'       read      's'
    'HasNoUsers'          read      'b'
    'HasMultipleUsers'    read      'b'
    'AutomaticLoginUsers' read      'ao'

## Description

## Details

### ListCachedUsers ()

    ListCachedUsers (out 'ao' users)

Lists users which have logged into the system locally before. This is not meant to return an exhaustive list of all users. It is possible for `FindUserByName()` to return a user that's not on the list.

`users`:

  Object paths of cached users

### FindUserById ()

    FindUserById (in  'x' id,
                  out 'o' user)

Finds a user by uid.

`id`:

  The uid to look up

`user`:

  Object path of user

### Errors

`org.freedesktop.Accounts.Error.Failed`:
  if no user with the given uid exists

### FindUserByName ()

    FindUserByName (in  's' name,
                    out 'o' user)

Finds a user by its username.

`name`:

  The username to look up

`user`:

  Object path of user

### Errors

`org.freedesktop.Accounts.Error.Failed`:
  if no user with the given username exists

### CreateUser ()

    CreateUser (in  's' name,
                in  's' fullname,
                out 'o' user,
                in  'i' accountType)

Creates a new user account.

The accountType argument can take the following values:

- 0: Standard user

- 1: Administrator

`name`:

  The username for the new user

`fullname`:

  The real name for the new user

`user`:

  Object path of the new user

`accountType`:

  The account type, encoded as an integer

### Errors

`org.freedesktop.Accounts.Error.PermissionDenied`:
  if the caller lacks the appropriate PolicyKit authorization
`org.freedesktop.Accounts.Error.Failed`:
  if the operation failed

### Permissions

The caller needs the org.freedesktop.accounts.user-administration PolicyKit authorization.

### CacheUser ()

    CacheUser (in  's' name,
               out 'o' user)

Caches a user account, so that it shows up in ListCachedUsers() output. The user name may be a remote user, but the system must be able to lookup the user name and resolve the user information.

`name`:

  The username for the user

`user`:

  Object path of user

### Errors

`org.freedesktop.Accounts.Error.PermissionDenied`:
  if the caller lacks the appropriate PolicyKit authorization
`org.freedesktop.Accounts.Error.UserDoesNotExist`:
  if the user name cannot be resolved

### Permissions

The caller needs the org.freedesktop.accounts.user-administration PolicyKit authorization.

### UncacheUser ()

    UncacheUser (in  's' name)

Releases all metadata about a user account, including icon, language and session. If the user account is from a remote server and the user has never logged in before, then that account will no longer show up in ListCachedUsers() output.

`name`:

  The username for the user

### Errors

`org.freedesktop.Accounts.Error.PermissionDenied`:
  if the caller lacks the appropriate PolicyKit authorization
`org.freedesktop.Accounts.Error.UserDoesNotExist`:
  if the user name cannot be resolved

### Permissions

The caller needs the org.freedesktop.accounts.user-administration PolicyKit authorization.

### DeleteUser ()

    DeleteUser (in  'x' id,
                in  'b' removeFiles)

Deletes a user account.

`id`:

  The uid to delete

`removeFiles`:

  Whether to remove the users files

### Errors

`org.freedesktop.Accounts.Error.PermissionDenied`:
  if the caller lacks the appropriate PolicyKit authorization
`org.freedesktop.Accounts.Error.Failed`:
  if the operation failed

### Permissions

The caller needs the org.freedesktop.accounts.user-administration PolicyKit authorization.

## Signal Details

### The UserAdded signal

    UserAdded ('o' user)

Emitted when a user is added.

`user`:
  Object path of the user that was added.

### The UserDeleted signal

    UserDeleted ('o' user)

Emitted when a user is deleted.

`user`:
  Object path of the user that was deleted.

## Property Details

### The "DaemonVersion" property

    'DaemonVersion'  read      's'

The version of the running daemon.

### The "HasNoUsers" property

    'HasNoUsers'  read      'b'

Whether or not the system has no users

### The "HasMultipleUsers" property

    'HasMultipleUsers'  read      'b'

Whether or not the system has multiple users

### The "AutomaticLoginUsers" property

    'AutomaticLoginUsers'  read      'ao'

Users to automatically log in as

## Name

org.freedesktop.Accounts.User — User interface

## Methods

    SetUserName                 (in  's' name)
    SetRealName                 (in  's' name)
    SetEmail                    (in  's' email)
    SetLanguage                 (in  's' language)
    SetXSession                 (in  's' x_session)
    SetSession                  (in  's' session)
    SetSessionType              (in  's' session_type)
    SetLocation                 (in  's' location)
    SetHomeDirectory            (in  's' homedir)
    SetShell                    (in  's' shell)
    SetIconFile                 (in  's' filename)
    SetLocked                   (in  'b' locked)
    SetAccountType              (in  'i' accountType)
    SetPasswordMode             (in  'i' mode)
    SetPassword                 (in  's' password,
                                 in  's' hint)
    SetPasswordHint             (in  's' hint)
    SetAutomaticLogin           (in  'b' enabled)
    GetPasswordExpirationPolicy (out 'x' expiration_time,
                                 out 'x' last_change_time,
                                 out 'x' min_days_between_changes,
                                 out 'x' max_days_between_changes,
                                 out 'x' days_to_warn,
                                 out 'x' days_after_expiration_until_lock)
    SetPasswordExpirationPolicy (in  'x' min_days_between_changes,
                                 in  'x' max_days_between_changes,
                                 in  'x' days_to_warn,
                                 in  'x' days_after_expiration_until_lock)
    SetUserExpirationPolicy     (in  'x' expiration_time)

## Signals

    Changed ()

## Implemented Interfaces

Objects implementing org.freedesktop.Accounts.User also implements org.freedesktop.DBus.Introspectable, org.freedesktop.DBus.Properties

## Properties

    'Uid'            read      't'
    'UserName'       read      's'
    'RealName'       read      's'
    'AccountType'    read      'i'
    'HomeDirectory'  read      's'
    'Shell'          read      's'
    'Email'          read      's'
    'Language'       read      's'
    'Session'        read      's'
    'SessionType'    read      's'
    'XSession'       read      's'
    'Location'       read      's'
    'LoginFrequency' read      't'
    'LoginTime'      read      'x'
    'LoginHistory'   read      'a(xxa{sv})'
    'IconFile'       read      's'
    'Saved'          read      'b'
    'Locked'         read      'b'
    'PasswordMode'   read      'i'
    'PasswordHint'   read      's'
    'AutomaticLogin' read      'b'
    'SystemAccount'  read      'b'
    'LocalAccount'   read      'b'

## Description

## Details

### SetUserName ()

    SetUserName (in  's' name)

Sets the users username. Note that it is usually not allowed to have multiple users with the same username.

`name`:

  The new username.

### Errors

`org.freedesktop.Accounts.Error.PermissionDenied`:
  if the caller lacks the appropriate PolicyKit authorization
`org.freedesktop.Accounts.Error.Failed`:
  if the operation failed

### Permissions

The caller needs one of the following PolicyKit authorizations:

- org.freedesktop.accounts.user-administration: To change the username of any user

### SetRealName ()

    SetRealName (in  's' name)

Sets the users real name.

`name`:

  The new name, typically in the form "Firstname Lastname".

### Errors

`org.freedesktop.Accounts.Error.PermissionDenied`:
  if the caller lacks the appropriate PolicyKit authorization
`org.freedesktop.Accounts.Error.Failed`:
  if the operation failed

### Permissions

The caller needs one of the following PolicyKit authorizations:

- org.freedesktop.accounts.change-own-user-data: To change his own name

- org.freedesktop.accounts.user-administration: To change the name of another user

### SetEmail ()

    SetEmail (in  's' email)

Sets the users email address.

Note that setting an email address in the AccountsService is not the same as configuring a mail client. Mail clients might default to email address that is configured here, though.

`email`:

  The new email address.

### Errors

`org.freedesktop.Accounts.Error.PermissionDenied`:
  if the caller lacks the appropriate PolicyKit authorization
`org.freedesktop.Accounts.Error.Failed`:
  if the operation failed

### Permissions

The caller needs one of the following PolicyKit authorizations:

- org.freedesktop.accounts.change-own-user-data: To change his own email address

- org.freedesktop.accounts.user-administration: To change the email address of another user

### SetLanguage ()

    SetLanguage (in  's' language)

Sets the users language.

The expectation is that display managers will start the users session with this locale.

`language`:

  The new language, as a locale specification like "de_DE.UTF-8".

### Errors

`org.freedesktop.Accounts.Error.PermissionDenied`:
  if the caller lacks the appropriate PolicyKit authorization
`org.freedesktop.Accounts.Error.Failed`:
  if the operation failed

### Permissions

The caller needs one of the following PolicyKit authorizations:

- org.freedesktop.accounts.change-own-user-data: To change his own language

- org.freedesktop.accounts.user-administration: To change the language of another user

### SetXSession ()

    SetXSession (in  's' x_session)

Sets the users x session.

The expectation is that display managers will log the user in to this specified session, if available. Note this call is deprecated and has been superceded by SetSession since not all graphical sessions use X as the display server.

`x_session`:

  The new xsession to start (e.g. "gnome")

### Errors

`org.freedesktop.Accounts.Error.PermissionDenied`:
  if the caller lacks the appropriate PolicyKit authorization
`org.freedesktop.Accounts.Error.Failed`:
  if the operation failed

### Permissions

The caller needs one of the following PolicyKit authorizations:

- org.freedesktop.accounts.change-own-user-data: To change his own language

- org.freedesktop.accounts.user-administration: To change the language of another user

### SetSession ()

    SetSession (in  's' session)

Sets the users wayland or x session.

The expectation is that display managers will log the user in to this specified session, if available.

`session`:

  The new session to start (e.g. "gnome-xorg")

### Errors

`org.freedesktop.Accounts.Error.PermissionDenied`:
  if the caller lacks the appropriate PolicyKit authorization
`org.freedesktop.Accounts.Error.Failed`:
  if the operation failed

### Permissions

The caller needs one of the following PolicyKit authorizations:

- org.freedesktop.accounts.change-own-user-data: To change his own language

- org.freedesktop.accounts.user-administration: To change the language of another user

### SetSessionType ()

    SetSessionType (in  's' session_type)

Sets the session type of the users session.

Display managers may use this property to decide what type of display server to use when loading the session

`session_type`:

  The type of the new session to start (e.g. "wayland" or "x11")

### Errors

`org.freedesktop.Accounts.Error.PermissionDenied`:
  if the caller lacks the appropriate PolicyKit authorization
`org.freedesktop.Accounts.Error.Failed`:
  if the operation failed

### Permissions

The caller needs one of the following PolicyKit authorizations:

- org.freedesktop.accounts.change-own-user-data: To change his own language

- org.freedesktop.accounts.user-administration: To change the language of another user

### SetLocation ()

    SetLocation (in  's' location)

Sets the users location.

`location`:

  The new location as a freeform string.

### Errors

`org.freedesktop.Accounts.Error.PermissionDenied`:
  if the caller lacks the appropriate PolicyKit authorization
`org.freedesktop.Accounts.Error.Failed`:
  if the operation failed

### Permissions

The caller needs one of the following PolicyKit authorizations:

- org.freedesktop.accounts.change-own-user-data: To change his own location

- org.freedesktop.accounts.user-administration: To change the location of another user

### SetHomeDirectory ()

    SetHomeDirectory (in  's' homedir)

Sets the users home directory.

Note that changing the users home directory moves all the content from the old location to the new one, and is potentially an expensive operation.

`homedir`:

  The new homedir as an absolute path.

### Errors

`org.freedesktop.Accounts.Error.PermissionDenied`:
  if the caller lacks the appropriate PolicyKit authorization
`org.freedesktop.Accounts.Error.Failed`:
  if the operation failed

### Permissions

The caller needs one of the following PolicyKit authorizations:

- org.freedesktop.accounts.user-administration: To change the home directory of a user

### SetShell ()

    SetShell (in  's' shell)

Sets the users shell.

Note that setting the shell to a non-allowed program may prevent the user from logging in.

`shell`:

  The new user shell.

### Errors

`org.freedesktop.Accounts.Error.PermissionDenied`:
  if the caller lacks the appropriate PolicyKit authorization
`org.freedesktop.Accounts.Error.Failed`:
  if the operation failed

### Permissions

The caller needs one of the following PolicyKit authorizations:

- org.freedesktop.accounts.user-administration: To change the shell of a user

### SetIconFile ()

    SetIconFile (in  's' filename)

Sets the users icon.

`filename`:

  The absolute filename of a png file to use as the users icon.

### Errors

`org.freedesktop.Accounts.Error.PermissionDenied`:
  if the caller lacks the appropriate PolicyKit authorization
`org.freedesktop.Accounts.Error.Failed`:
  if the operation failed

### Permissions

The caller needs one of the following PolicyKit authorizations:

- org.freedesktop.accounts.change-own-user-data: To change his own icon

- org.freedesktop.accounts.user-administration: To change the icon of another user

### SetLocked ()

    SetLocked (in  'b' locked)

Locks or unlocks a users account.

Locking an account prevents the user from logging in.

`locked`:

  Whether to lock or unlock the users account.

### Errors

`org.freedesktop.Accounts.Error.PermissionDenied`:
  if the caller lacks the appropriate PolicyKit authorization
`org.freedesktop.Accounts.Error.Failed`:
  if the operation failed

### Permissions

The caller needs one of the following PolicyKit authorizations:

- org.freedesktop.accounts.user-administration: To lock or unlock user accounts

### SetAccountType ()

    SetAccountType (in  'i' accountType)

Changes the users account type.

`accountType`:

  The new account type, encoded as an integer:

  - 0: Standard user

  - 1: Administrator

### Errors

`org.freedesktop.Accounts.Error.PermissionDenied`:
  if the caller lacks the appropriate PolicyKit authorization
`org.freedesktop.Accounts.Error.Failed`:
  if the operation failed

### Permissions

The caller needs one of the following PolicyKit authorizations:

- org.freedesktop.accounts.user-administration: To change an account type

### SetPasswordMode ()

    SetPasswordMode (in  'i' mode)

Changes the users password mode.

Note that changing the password mode has the side-effect of unlocking the account.

`mode`:

  The new password mode, encoded as an integer:

  - 0: Regular password

  - 1: Password must be set at next login

  - 2: No password

### Errors

`org.freedesktop.Accounts.Error.PermissionDenied`:
  if the caller lacks the appropriate PolicyKit authorization
`org.freedesktop.Accounts.Error.Failed`:
  if the operation failed

### Permissions

The caller needs one of the following PolicyKit authorizations:

- org.freedesktop.accounts.user-administration: To change a users password mode

### SetPassword ()

    SetPassword (in  's' password,
                 in  's' hint)

Sets a new password for this user.

Note that setting a password has the side-effect of unlocking the account.

`password`:

  The crypted password.

`hint`:

  The password hint.

### Errors

`org.freedesktop.Accounts.Error.PermissionDenied`:
  if the caller lacks the appropriate PolicyKit authorization
`org.freedesktop.Accounts.Error.Failed`:
  if the operation failed

### Permissions

The caller needs one of the following PolicyKit authorizations:

- org.freedesktop.accounts.user-administration: To change the password of a user

### SetPasswordHint ()

    SetPasswordHint (in  's' hint)

Sets the users password hint.

`hint`:

  The password hint.

### Errors

`org.freedesktop.Accounts.Error.PermissionDenied`:
  if the caller lacks the appropriate PolicyKit authorization
`org.freedesktop.Accounts.Error.Failed`:
  if the operation failed

### Permissions

The caller needs one of the following PolicyKit authorizations:

- org.freedesktop.accounts.change-own-user-data: To change his own language

- org.freedesktop.accounts.user-administration: To change the language of another user

### SetAutomaticLogin ()

    SetAutomaticLogin (in  'b' enabled)

Enables or disables automatic login for a user.

Note that usually only one user can have automatic login enabled, so turning it on for a user will disable it for the previously configured autologin user.

`enabled`:

  Whether to enable automatic login for this user.

### Errors

`org.freedesktop.Accounts.Error.PermissionDenied`:
  if the caller lacks the appropriate PolicyKit authorization
`org.freedesktop.Accounts.Error.Failed`:
  if the operation failed

### Permissions

The caller needs one of the following PolicyKit authorizations:

- org.freedesktop.accounts.set-login-option: To change the login screen configuration

### GetPasswordExpirationPolicy ()

    GetPasswordExpirationPolicy (out 'x' expiration_time,
                                 out 'x' last_change_time,
                                 out 'x' min_days_between_changes,
                                 out 'x' max_days_between_changes,
                                 out 'x' days_to_warn,
                                 out 'x' days_after_expiration_until_lock)

`expiration_time`:

`last_change_time`:

`min_days_between_changes`:

`max_days_between_changes`:

`days_to_warn`:

`days_after_expiration_until_lock`:

### SetPasswordExpirationPolicy ()

    SetPasswordExpirationPolicy (in  'x' min_days_between_changes,
                                 in  'x' max_days_between_changes,
                                 in  'x' days_to_warn,
                                 in  'x' days_after_expiration_until_lock)

`min_days_between_changes`:

`max_days_between_changes`:

`days_to_warn`:

`days_after_expiration_until_lock`:

### SetUserExpirationPolicy ()

    SetUserExpirationPolicy (in  'x' expiration_time)

`expiration_time`:

## Signal Details

### The Changed signal

    Changed ()

Emitted when the user is changed.

## Property Details

### The "Uid" property

    'Uid'  read      't'

The uid of the user.

### The "UserName" property

    'UserName'  read      's'

The username of the user.

### The "RealName" property

    'RealName'  read      's'

The users real name.

### The "AccountType" property

    'AccountType'  read      'i'

The users account type, encoded as an integer:

- 0: Standard user

- 1: Administrator

### The "HomeDirectory" property

    'HomeDirectory'  read      's'

The users home directory.

### The "Shell" property

    'Shell'  read      's'

The users shell.

### The "Email" property

    'Email'  read      's'

The email address.

### The "Language" property

    'Language'  read      's'

The users language, as a locale specification like "de_DE.UTF-8".

### The "Session" property

    'Session'  read      's'

The users Wayland or X session.

### The "SessionType" property

    'SessionType'  read      's'

The type of session the user should use (e.g. "wayland" or "x11")

### The "XSession" property

    'XSession'  read      's'

The users x session.

### The "Location" property

    'Location'  read      's'

The users location.

### The "LoginFrequency" property

    'LoginFrequency'  read      't'

How often the user has logged in.

### The "LoginTime" property

    'LoginTime'  read      'x'

The last login time.

### The "LoginHistory" property

    'LoginHistory'  read      'a(xxa{sv})'

The login history for this user. Each entry in the array represents a login session. The first two members are the login time and logout time, as timestamps (seconds since the epoch). If the session is still running, the logout time is 0.

The a{sv} member is a dictionary containing additional information about the session. Possible members include 'type' (with values like ':0', 'tty0', 'pts/0' etc).

### The "IconFile" property

    'IconFile'  read      's'

The filename of a png file containing the users icon.

### The "Saved" property

    'Saved'  read      'b'

Whether the users account has retained state

### The "Locked" property

    'Locked'  read      'b'

Whether the users account is locked.

### The "PasswordMode" property

    'PasswordMode'  read      'i'

The password mode for the user account, encoded as an integer:

- 0: Regular password

- 1: Password must be set at next login

- 2: No password

### The "PasswordHint" property

    'PasswordHint'  read      's'

The password hint for the user.

### The "AutomaticLogin" property

    'AutomaticLogin'  read      'b'

Whether automatic login is enabled for the user.

### The "SystemAccount" property

    'SystemAccount'  read      'b'

Whether this is a 'system' account, like 'root' or 'nobody'. System accounts should normally not appear in lists of users, and ListCachedUsers will not include such accounts.

### The "LocalAccount" property

    'LocalAccount'  read      'b'

Whether the user is a local account or not.

# Index

### A

AccountType
  User, The "AccountType" property
AutomaticLogin
  User, The "AutomaticLogin" property
AutomaticLoginUsers
  Accounts, The "AutomaticLoginUsers" property

### C

CacheUser
  Accounts, CacheUser ()
Changed
  User, The Changed signal
CreateUser
  Accounts, CreateUser ()

### D

DaemonVersion
  Accounts, The "DaemonVersion" property
DeleteUser
  Accounts, DeleteUser ()

### E

Email
  User, The "Email" property

### F

FindUserById
  Accounts, FindUserById ()
FindUserByName
  Accounts, FindUserByName ()

### G

GetPasswordExpirationPolicy
  User, GetPasswordExpirationPolicy ()

### H

HasMultipleUsers
  Accounts, The "HasMultipleUsers" property
HasNoUsers
  Accounts, The "HasNoUsers" property
HomeDirectory
  User, The "HomeDirectory" property

### I

IconFile
  User, The "IconFile" property

### L

Language
  User, The "Language" property
ListCachedUsers
  Accounts, ListCachedUsers ()
LocalAccount
  User, The "LocalAccount" property
Location
  User, The "Location" property
Locked
  User, The "Locked" property
LoginFrequency
  User, The "LoginFrequency" property
LoginHistory
  User, The "LoginHistory" property
LoginTime
  User, The "LoginTime" property

### P

PasswordHint
  User, The "PasswordHint" property
PasswordMode
  User, The "PasswordMode" property

### R

RealName
  User, The "RealName" property

### S

Saved
  User, The "Saved" property
Session
  User, The "Session" property
SessionType
  User, The "SessionType" property
SetAccountType
  User, SetAccountType ()
SetAutomaticLogin
  User, SetAutomaticLogin ()
SetEmail
  User, SetEmail ()
SetHomeDirectory
  User, SetHomeDirectory ()
SetIconFile
  User, SetIconFile ()
SetLanguage
  User, SetLanguage ()
SetLocation
  User, SetLocation ()
SetLocked
  User, SetLocked ()
SetPassword
  User, SetPassword ()
SetPasswordExpirationPolicy
  User, SetPasswordExpirationPolicy ()
SetPasswordHint
  User, SetPasswordHint ()
SetPasswordMode
  User, SetPasswordMode ()
SetRealName
  User, SetRealName ()
SetSession
  User, SetSession ()
SetSessionType
  User, SetSessionType ()
SetShell
  User, SetShell ()
SetUserExpirationPolicy
  User, SetUserExpirationPolicy ()
SetUserName
  User, SetUserName ()
SetXSession
  User, SetXSession ()
Shell
  User, The "Shell" property
SystemAccount
  User, The "SystemAccount" property

### U

Uid
  User, The "Uid" property
UncacheUser
  Accounts, UncacheUser ()
UserAdded
  Accounts, The UserAdded signal
UserDeleted
  Accounts, The UserDeleted signal
UserName
  User, The "UserName" property

### X

XSession
  User, The "XSession" property