{"id":15511587,"url":"https://github.com/rnelson0/puppet-local_user","last_synced_at":"2025-12-17T02:56:25.891Z","repository":{"id":25141490,"uuid":"28563722","full_name":"rnelson0/puppet-local_user","owner":"rnelson0","description":"Puppet module. Manage local users, setting an initial password but letting the user change it as needed afterward.","archived":false,"fork":false,"pushed_at":"2019-12-27T18:28:46.000Z","size":90,"stargazers_count":4,"open_issues_count":10,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-21T19:59:27.855Z","etag":null,"topics":["puppet-module"],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rnelson0.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-12-28T14:31:02.000Z","updated_at":"2019-12-27T16:54:52.000Z","dependencies_parsed_at":"2022-08-23T19:51:08.406Z","dependency_job_id":null,"html_url":"https://github.com/rnelson0/puppet-local_user","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rnelson0%2Fpuppet-local_user","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rnelson0%2Fpuppet-local_user/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rnelson0%2Fpuppet-local_user/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rnelson0%2Fpuppet-local_user/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rnelson0","download_url":"https://codeload.github.com/rnelson0/puppet-local_user/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250360496,"owners_count":21417721,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["puppet-module"],"created_at":"2024-10-02T09:53:07.847Z","updated_at":"2025-12-17T02:56:25.862Z","avatar_url":"https://github.com/rnelson0.png","language":"Ruby","readme":"# local_user\n\n[![Build Status](https://travis-ci.org/rnelson0/puppet-local_user.png?branch=master)](https://travis-ci.org/rnelson0/puppet-local_user)\n[![Puppet Forge](http://img.shields.io/puppetforge/v/rnelson0/local_user.svg)](https://forge.puppetlabs.com/rnelson0/local_user)\n[![Puppet Forge Downloads](http://img.shields.io/puppetforge/dt/rnelson0/local_user.svg)](https://forge.puppetlabs.com/rnelson0/local_user)\n\n#### Table of Contents\n\n1. [Overview](#overview)\n2. [Usage - Configuration options and additional functionality](#usage)\n    * [Resource Definition](#resource-definition)\n    * [Via Hiera](#via-hiera)\n3. [Caveats and Clarifications](#caveats-and-clarifications)\n\n\n## Overview\n\nThis module provides a defined type, local_user, that wraps the puppet 'user'\nresource type with validation. You may also provide a initial password that is\nset only when the user has no password, as a brand new 'user' resource puppet\ncreates will have. This allows users to maintain their own passwords after\ncreation.\n\n## Usage\n\n### Resource Definition\n\nCreate a local user by providing at a minimum the user name, state,\ngroups, and initial password:\n\n    local_user { 'rnelson':\n      state            =\u003e 'present',\n      groups           =\u003e ['group1', 'group2'],\n      password         =\u003e 'encryptedstring',\n    }\n\nYou may also provide the shell, home directory, password max age, the last\nchange date (YYYY-MM-DD or number of days since Jan 1, 1970), and an array of ssh keys. These values\ndefault to /bin/bash, /home/\u003cusername\u003e, 90 days, 0 days, and null, respectively.\n\n    local_user { 'rnelson':\n      state            =\u003e 'present',\n      shell            =\u003e '/bin/bash',\n      home             =\u003e '/home/rnelson0',\n      managehome       =\u003e true,\n      comment          =\u003e 'Rob Nelson',\n      groups           =\u003e ['rnelson0', 'wheel'],\n      gid              =\u003e 'rnelson0'\n      manage_groups    =\u003e true,\n      last_change      =\u003e '2015-01-01',\n      password         =\u003e 'encryptedstring',\n      password_max_age =\u003e 1000,\n      ssh_authorized_keys =\u003e ['ssh-rsa AAAA...123 user@host'],\n    }\n\nStarting with v1.0.8, a new `local_user::windows` type is available.\nThe user can be given access to the administrator or remote desktop user groups with the parameters `$admin` (default false) and `$allow_rdp` (default true).\nIt shares the common parameters of `$state`, `$password`, `$groups`, and `$comment`.\nUnlike the unix version of `local_user`, the password is unencrypted and will be reset on every run.\n\n    local_user::windows { 'bob' :\n      state     =\u003e present,\n      password  =\u003e 'Bobbo1234',\n      groups    =\u003e ['Administrators'],\n      comment   =\u003e 'Bob is Cool',\n      allow_rdp =\u003e true,\n    }\n\n### Via Hiera\n\nYou can also store your user information in hiera and use the `create_resources()` function to create the users. The user(s) can be defined in the appropriate level(s) of your hierarchy, for example at the least-specific level, `global.yaml`:\n\n````\n# global.yaml\n---\nlocal_users:\n  rnelson0:\n    state:            'present'\n    home:             '/home/rnelson0'\n    managehome:       true\n    comment:          'Rob Nelson'\n    groups:\n      - 'rnelson0'\n      - 'wheel'\n    gid:              'rnelson0'\n    manage_groups:    true\n    last_change:      '2015-01-01'\n    password:         'encryptedstring'\n    password_max_age: '1000'\n    ssh_authorized_keys:\n      - 'ssh-rsa AAAA...123 user@host'\n````\n\nAdd code similar to the following black to a common class, such as `profile::base`. The result of the hiera lookup for `local_users`, using your hiera merge strategy, will be discovered and added to the node's manifest.\n\n````\n# Puppet 3\n# profile/manifests/base.pp\nclass profile::base {\n  # Your base profile goes here\n\n  $local_users = hiera('local_users', undef)\n  if ($local_users) {\n    create_resources('local_user', $local_users)\n  }\n}\n````\n\n````\n# Puppet 4\nclass profile::base {\n  # Your base profile goes here\n\n  $user_defaults = {\n    state =\u003e 'present',\n  }\n  $local_users = hiera('local_users', undef)\n  $local_users.each |$user, $attributes| {\n    local_user{ \n      default:\n        * =\u003e $user_defaults;\n      $user:\n        * =\u003e $attributes,\n    }\n  }\n````\n\nThis example is functionally equivalent to the second [Resource Definition](#resource-definition) example.\n\n## Caveats and Clarifications\n\n* When no `$comment` is provided, the comment field will contain the username.\n\n* If the specified groups do not exist and or not created elsewhere in your catalog (or ordered incorrectly), you will receive errors preventing the user from being created. Set the parameter `manage_groups` to `true` and the groups will be managed and ordered within `local_user`. The error looks like:\n````\nError: Could not create user rnelson0: Execution of '/usr/sbin/useradd -c Rob Nelson -g rnelson0 -G wheel\n-d /home/rnelson0 -s /bin/bash -m rnelson0' returned 6: useradd: group 'rnelson0' does not exist\n````\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frnelson0%2Fpuppet-local_user","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frnelson0%2Fpuppet-local_user","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frnelson0%2Fpuppet-local_user/lists"}