since: 2.26


g_credentials_set_unix_user (
  GCredentials* credentials,
  uid_t uid,
  GError** error


Tries to set the UNIX user identifier on credentials. This method is only available on UNIX platforms.

This operation can fail if GCredentials is not supported on the OS or if the native credentials type does not contain information about the UNIX user. It can also fail if the OS does not allow the use of “spoofed” credentials.

Available since: 2.26



Type: uid_t

The UNIX user identifier to set.


Type: GError **

The return location for a recoverable error.

The argument can be NULL.
If the return location is not NULL, then you must initialize it to a NULL GError*.
The argument will be left initialized to NULL by the method if there are no errors.
In case of error, the argument will be set to a newly allocated GError; the caller will take ownership of the data, and be responsible for freeing it.

Return value

Type: gboolean

TRUE if uid was set, FALSE if error is set.