Class AutomateIt::AccountManager
In: lib/automateit/account_manager.rb
Parent: AutomateIt::Plugin::Manager

AccountManager

The AccountManager provides a way of managing system accounts, such as Unix users and groups.

Methods

Classes and Modules

Class AutomateIt::AccountManager::BaseDriver
Class AutomateIt::AccountManager::Etc
Class AutomateIt::AccountManager::NSCD
Class AutomateIt::AccountManager::POSIX
Class AutomateIt::AccountManager::PasswdExpect
Class AutomateIt::AccountManager::PasswdPTY

Public Instance methods

Add groupname if it doesn‘t exist. Options:

  • :members — Array of usernames to add as members.
  • :gid — Group ID to use. Default is to find an unused id.

Add groups (array of groupnames) to user.

Add the username if not already created.

Options:

  • :description — User‘s full name. Defaults to username.
  • :home — Path to user‘s home directory. If not specified, uses system default like "/home/username".
  • :create_home — Create homedir. Defaults to true.
  • :groups — Array of group names to add this user to.
  • :shell — Path to login shell. If not specified, uses system default like "/bin/bash".
  • :uid — Fixnum user ID for user. Default chooses an unused id.
  • :gid — Fixnum group ID for user. Default chooses same gid as uid.

Example:

  add_user("bob", :description => "Bob Smith")

Add users (array of usernames) to group.

Find a group. Method returns a query helper which takes a groupname as an index argument and returns a Struct::Group entry as described in Etc::getgrent if the group exists or a nil if not.

Example:

  groups["root"] # => #<struct Struct::Group name="root"...

  groups["does_not_exist"] # => nil

Array of groupnames this user is a member of.

Does group exist?

Is user present?

Invalidate system cache for database. The database can be either :users or :groups. This is necessary on operating systems that lack logic to notify their caching system that an entry changed. If the OS doesn‘t need invalidation, will do nothing and return false.

This method is primarily for the sake of driver authors, recipe authors will probably never need to use this.

Change the password for the user.

Remove groupname if it exists.

Remove groups (array of groupnames) from user.

Remove the username if present.

Options:

  • :remove_home — Delete user‘s home directory and mail spool. Default is true.

Remove users (array of usernames) from group.

Find a user account. Method returns a query helper which takes a username as an index argument and returns a Struct::Passwd entry as described in Etc::getpwent if the user exists or a nil if not.

Example:

  users["root"] # => #<struct Struct::Passwd name="root"...

  users["does_not_exist"] # => nil

Array of usernames in group.

Hash of usernames and the groupnames they‘re members of.

[Validate]