{ "name": "user", "description": "A convenient Chef LWRP to manage user accounts and SSH keys (this is not the opscode users cookbook)", "long_description": "# User Chef Cookbook\n\n[![Build Status](https://secure.travis-ci.org/fnichol/chef-user.png?branch=master)](http://travis-ci.org/fnichol/chef-user)\n\n## Description\n\nA convenient Chef LWRP to manage user accounts and SSH keys. This is **not**\nthe Opscode *users* cookbook.\n\n* Website: http://fnichol.github.io/chef-user/\n* Opscode Community Site: http://community.opscode.com/cookbooks/user\n* Source Code: https://github.com/fnichol/chef-user\n\n## Usage\n\nSimply include this cookbook as a dependency in `metadata.rb` and the `user_account`\nresource will be available. Example:\n\n # In your_cookbook/metadata.rb\n depends 'user'\n\n # In your_cookbook/recipes/default.rb\n user_account 'hsolo' do\n ssh_keygen true\n end\n\nTo use `recipe[user::data_bag]`, include it in your run\\_list and have a\ndata bag called `\"users\"` with an item like the following:\n\n {\n \"id\" : \"hsolo\",\n \"comment\" : \"Han Solo\",\n \"home\" : \"/opt/hoth/hsolo\",\n \"groups\" : [\"admin\", \"www-data\"],\n \"ssh_keys\" : [\"123...\", \"456...\"]\n }\n\nor a user to be removed:\n\n {\n \"id\" : \"lando\",\n \"action\" : \"remove\"\n }\n\nIf you have a username containing a period, use a dash in the data bag item\nand set a `username` attribute:\n\n {\n \"id\" : \"luke-skywalker\",\n \"username\" : \"luke.skywalker\",\n \"action\" : [\"create\", \"lock\"]\n }\n\nThe data bag recipe will iterate through a list of usernames defined in\n`node['users']` (by default) and attempt to pull in the user's information\nfrom the data bag item. In other words, having:\n\n node['users'] = ['hsolo', 'lando', 'luke.skywalker']\n\nwill set up the `hsolo` user information and not use the `lando` user\ninformation.\n\n## Requirements\n\n### Chef\n\nTested on 0.10.8 but newer and older version should work just fine. File an\n[issue][issues] if this isn't the case.\n\n### Platform\n\nThe following platforms have been tested with this cookbook, meaning that the\nrecipes run on these platforms without error:\n\n* ubuntu\n* debian\n* mac_os_x\n\n### Cookbooks\n\nThere are **no** external cookbook dependencies.\n\n## Installation\n\nDepending on the situation and use case there are several ways to install\nthis cookbook. All the methods listed below assume a tagged version release\nis the target, but omit the tags to get the head of development. A valid\nChef repository structure like the [Opscode repo][chef_repo] is also assumed.\n\n### From the Community Site\n\nTo install this cookbook from the Community Site, use the *knife* command:\n\n knife cookbook site install user\n\n### Using Berkshelf\n\n[Berkshelf][berkshelf] is a cookbook dependency manager and development\nworkflow assistant. To install Berkshelf:\n\n cd chef-repo\n gem install berkshelf\n berks init\n\nTo use the Community Site version:\n\n echo \"cookbook 'user'\" >> Berksfile\n berks install\n\nOr to reference the Git version:\n\n repo=\"fnichol/chef-user\"\n latest_release=$(curl -s https://api.github.com/repos/$repo/git/refs/tags \\\n | ruby -rjson -e '\n j = JSON.parse(STDIN.read);\n puts j.map { |t| t[\"ref\"].split(\"/\").last }.sort.last\n ')\n cat >> Berksfile < 'git://github.com/$repo.git', :branch => '$latest_release'\n END_OF_BERKSFILE\n berks install\n\n### Using Librarian-Chef\n\n[Librarian-Chef][librarian] is a bundler for your Chef cookbooks.\nTo install Librarian-Chef:\n\n cd chef-repo\n gem install librarian\n librarian-chef init\n\nTo use the Opscode platform version:\n\n echo \"cookbook 'user'\" >> Cheffile\n librarian-chef install\n\nOr to reference the Git version:\n\n repo=\"fnichol/chef-user\"\n latest_release=$(curl -s https://api.github.com/repos/$repo/git/refs/tags \\\n | ruby -rjson -e '\n j = JSON.parse(STDIN.read);\n puts j.map { |t| t[\"ref\"].split(\"/\").last }.sort.last\n ')\n cat >> Cheffile < 'git://github.com/$repo.git', :ref => '$latest_release'\n END_OF_CHEFFILE\n librarian-chef install\n\n## Recipes\n\n### default\n\nThis recipe is a no-op and does nothing.\n\n### data_bag\n\nProcesses a list of users with data drawn from a data bag. The default data bag\nis `users` and the list of user accounts to create on this node is set on\n`node['users']`.\n\n## Attributes\n\n### home_root\n\nThe default parent path of a user's home directory. Each resource can override\nthis value which varies by platform. Generally speaking, the default value is\n`\"/home\"`.\n\n### default_shell\n\nThe default user shell given to a user. Each resource can override this value\nwhich varies by platform. Generally speaking, the default value is\n`\"/bin/bash\"`.\n\n### home_dir_mode\n\nThe default Unix permissions applied to a user's home directory.\n\nThe default is `\"2755\"`.\n\n### manage_home\n\nWhether of not to manage the home directory of a user by default. Each resource\ncan override this value. The are 2 valid states:\n\n* `\"true\"`, `true`, or `\"yes\"`: will manage the user's home directory.\n* `\"false\"`, `false`, or `\"no\"`: will not manage the user's home directory.\n\nThe default is `true`.\n\n### non_unique\n\nWhether of not to allow the creation of a user account with a duplicate UID.\nEach resource can override this value. The are 2 valid states:\n\n* `\"true\"`, `true`, or `\"yes\"`: will allow duplicate UIDs.\n* `\"false\"`, `false`, or `\"no\"`: will not allow duplicate UIDs.\n\nThe default is `false`.\n\n### create_group\n\nWhether or not to to create a group with the same name as the user by default.\nEach resource can override this value. The are 2 valid states:\n\n* `\"true\"`, `true`, or `\"yes\"`: will create a group for the user by default.\n* `\"false\"`, `false`, or `\"no\"`: will not create a group for the user by default.\n\nThe default is `true`.\n\n### ssh_keygen\n\nWhether or not to generate an SSH keypair for the user by default. Each\nresource can override this value. There are 2 valid states:\n\n* `\"true\"`, `true`, or `\"yes\"`: will generate an SSH keypair when the account\n is created.\n* `\"false\"`, `false`, or `\"no\"`: will not generate an SSH keypair when the account\n is created.\n\nThe default is `true`.\n\n### data_bag_name\n\nThe data bag name containing a group of user account information. This is used\nby the `data_bag` recipe to use as a database of user accounts.\n\nThe default is `\"users\"`.\n\n### user_array_node_attr\n\nThe node attributes containing an array of users to be managed. If a nested\nhash in the node's attributes is required, then use a `/` between subhashes.\nFor example, if the users' array is stored in `node['system']['accounts']`),\nthen set `node['user']['user_array_node_attr']` to `\"system/accounts\"`.\n\nThe default is `\"users\"`.\n\n## Resources and Providers\n\n### user_account\n\n**Note:** in order to use the `password` attribute, you must have the\n[ruby-shadow gem][ruby-shadow_gem] installed. On Debian/Ubuntu you can get\nthis by installing the \"libshadow-ruby1.8\" package.\n\n### Actions\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
ActionDescriptionDefault
create\n Create the user, its home directory, .ssh/authorized_keys,\n and .ssh/{id_rsa,id_rsa.pub}.\n Yes
removeRemove the user account. 
modifyModify the user account. 
manageManage the user account. 
lockLock the user's password. 
unlockUnlock the user's password. 
\n\n### Attributes\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
AttributeDescriptionDefault Value
usernameName attribute: The name of the user.nil
commentGecos/Comment field.nil
uidThe numeric user id.nil
gidThe primary group id.nil
groupsArray of other groups this user should be a member of.nil
homeHome directory location.\"#{node['user']['home_root']}/#{username}
shellThe login shell.node['user']['default_shell']
passwordShadow hash of password.nil
system_userWhether or not to create a system user.false
manage_homeWhether or not to manage the home directory.true
non_uniqueWhether or not to allow the creation of a user account with a duplicate UID.false
create_group\n Whether or not to to create a group with the same name as the user.\n node['user']['create_group']
ssh_keys\n A String or Array of SSH public keys to populate the\n user's .ssh/authorized_keys file.\n []
ssh_keygenWhether or not to generate an SSH keypair for the user.node['user']['ssh_keygen']
groupsAn Array of groups to which to add the user.[]
\n\n#### Examples\n\n##### Creating a User Account\n\n user_account 'hsolo' do\n comment 'Han Solo'\n ssh_keys ['3dc348d9af8027df7b9c...', '2154d3734d609eb5c452...']\n home '/opt/hoth/hsolo'\n end\n\n##### Creating and Locking a User Account\n\n user_account 'lando' do\n action [:create, :lock]\n end\n\n##### Removing a User account\n\n user_account 'obiwan' do\n action :remove\n end\n\n## Development\n\n* Source hosted at [GitHub][repo]\n* Report issues/Questions/Feature requests on [GitHub Issues][issues]\n\nPull requests are very welcome! Make sure your patches are well tested.\nIdeally create a topic branch for every separate change you make.\n\n## License and Author\n\nAuthor:: [Fletcher Nichol][fnichol] () [![endorse](http://api.coderwall.com/fnichol/endorsecount.png)](http://coderwall.com/fnichol)\n\nCopyright 2011, Fletcher Nichol\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n\n[berkshelf]: http://berkshelf.com/\n[chef_repo]: https://github.com/opscode/chef-repo\n[cheffile]: https://github.com/applicationsonline/librarian/blob/master/lib/librarian/chef/templates/Cheffile\n[kgc]: https://github.com/websterclay/knife-github-cookbooks#readme\n[librarian]: https://github.com/applicationsonline/librarian#readme\n[ruby-shadow_gem]: https://rubygems.org/gems/ruby-shadow\n\n[repo]: https://github.com/fnichol/chef-user\n[issues]: https://github.com/fnichol/chef-user/issues\n", "maintainer": "Fletcher Nichol", "maintainer_email": "fnichol@nichol.ca", "license": "Apache 2.0", "platforms": { "ubuntu": ">= 0.0.0", "debian": ">= 0.0.0", "mac_os_x": ">= 0.0.0", "suse": ">= 0.0.0", "omnios": ">= 0.0.0" }, "dependencies": { }, "recommendations": { }, "suggestions": { }, "conflicting": { }, "providing": { }, "replacing": { }, "attributes": { }, "groupings": { }, "recipes": { "user": "This recipe is a no-op and does nothing.", "user::data_bag": "Processes a list of users with data drawn from a data bag." }, "version": "0.4.2", "source_url": "", "issues_url": "" }