Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@juanje
Created October 21, 2011 09:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save juanje/1303414 to your computer and use it in GitHub Desktop.
Save juanje/1303414 to your computer and use it in GitHub Desktop.
Chef ohai plugin for home users
provides 'home_users'
require 'etc'
home_users Mash.new
etcpasswd = []
Etc.passwd do |entry|
etcpasswd << entry
end
Dir["/home/*"].each do |homedir|
etcpasswd.each do |entry|
if homedir == entry.dir
home_users[homedir] = Mash.new(
:username => entry.name,
:gid => entry.gid,
:uid => entry.uid,
:gecos => entry.gecos
)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment