[][src]Module fungus::sys::user

Structs

User

User provides options for a specific user.

Functions

cache_dir

Returns the full path to the current user's cache directory. Where user-specific non-essential (cached) data should be written (analogous to /var/cache). Defaults to $HOME/.cache.

config_dir

Returns the full path to the current user's config directory. Where user-specific configurations should be written (analogous to /etc). Defaults to $HOME/.config.

config_dirs

Returns the current user's config directories. List of directories seperated by : (analogous to PATH). Defaults to /etc/xdg

current

Get the current user

data_dir

Returns the full path to the current user's data directory. Where user-specific data files should be written (analogous to /usr/share). Defaults to $HOME/.local/share

data_dirs

Returns the current user's data directories. List of directories seperated by : (analogous to PATH). Defaults to /usr/local/share:/usr/share.

drop_sudo

Switches back to the original user under the sudo mask with no way to go back.

getegid

Returns the group effective ID for the current user.

geteuid

Returns the user effective ID for the current user.

getgid

Returns the group ID for the current user.

getrids

Returns the real IDs for the given user.

getuid

Returns the user ID for the current user.

home_dir

Returns the full path to the current user's home directory.

is_root

Return true if the current user is the root user.

lookup

Lookup a user by user id

name

Returns the current user's name.

path_dirs

Returns the current user's path directories. List of directories seperated by :

pause_sudo

Switches back to the original user under the sudo mask. Preserves the ability to raise sudo again.

runtime_dir

Returns the full path to the current user's runtime directory. Used for non-essential, user-specific data files such as sockets, named pipes, etc. Must be owned by the user with an access mode of 0700. Filesystem fully featured by standards of OS. Must be on the local filesystem. May be subject to periodic cleanup. Modified every 6 hours or set sticky bit if persistence is desired. Can only exist for the duration of the user's login. Should not store large files as it may be mounted as a tmpfs.

setegid

Set the group effective ID for the current user.

seteuid

Set the user effective ID for the current user.

setgid

Set the group ID for the current user.

setuid

Set the user ID for the current user.

sudo

Switches back to sudo root. Returns and error if not allowed.

switchuser

Switches to another use by setting the real, effective and saved user and group ids.

temp_dir

Returns the full path to a newly created directory in /tmp that can be used for temporary work. The returned path will be checked for uniqueness and created with a random suffix and the given prefix. It is up to the calling code to ensure the directory returned is properly cleaned up when done with.