Skip to content

Instantly share code, notes, and snippets.

@thehar
Created August 8, 2013 19:36
Show Gist options
  • Save thehar/6187941 to your computer and use it in GitHub Desktop.
Save thehar/6187941 to your computer and use it in GitHub Desktop.
begin
require 'ruby-shadow'
user_pw = u['password']
rescue LoadError
user_pw = nil
end
# Create user object.
# Do NOT try to manage null home directories.
user u['id'] do
uid u['uid']
if u['gid']
gid u['gid']
end
shell u['shell']
password user_pw
comment u['comment']
if home_dir == "/dev/null"
supports :manage_home => false
else
supports :manage_home => true
end
home home_dir
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment