Skip to content

Instantly share code, notes, and snippets.

@adamhjk
Created October 16, 2009 20:14
Show Gist options
  • Save adamhjk/212042 to your computer and use it in GitHub Desktop.
Save adamhjk/212042 to your computer and use it in GitHub Desktop.
#
# Cookbook Name:: users
# Recipe:: default
#
# Copyright 2009, Opscode, Inc
package "libshadow-ruby1.8"
group "sysadmin" do
gid 4242
end
node[:opscode][:users].each do |username, user|
user[:username] = username
user user[:username] do
comment user[:comment]
uid user[:uid]
gid 4242
home "/home/#{user[:username]}"
shell user[:shell]
password user[:password]
end
directory "/home/#{user[:username]}" do
owner user[:uid]
group 4242
mode "0700"
end
directory "/home/#{user[:username]}/.ssh" do
owner user[:uid]
group 4242
mode "0700"
end
template "/home/#{user[:username]}/.ssh/authorized_keys" do
source "authorized_keys.erb"
owner user[:uid]
group 4242
mode "0600"
variables :ssh_key => user[:ssh_key]
end
user[:rcfiles].each do |source_file, remote|
remote_file "/home/#{user[:username]}/#{remote}" do
source "#{user[:username]}/#{source_file}"
owner user[:uid]
group 4242
mode "0600"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment