Skip to content

Instantly share code, notes, and snippets.

@uu59
Created May 3, 2013 04:51
Show Gist options
  • Save uu59/5507272 to your computer and use it in GitHub Desktop.
Save uu59/5507272 to your computer and use it in GitHub Desktop.
vagrantでユーザーを作ってパスワードも設定したいとき ref: http://qiita.com/items/141fecf6f5ed2d83ada0
myuser = "uu59"
user myuser do
username myuser
# ruby-shadowが必要とか言われてこけるのでいったんnilにする
#password "$6$salt1234$IjyVJemPr/rDex7jMj7.mfzJVRqJIgjG79ZKkknhLi4/P6OGc7GjWTVBRuqWmvH2hlZyfRXzO46tPAPRrzxne1"
#password "$1$salt1234$iNjm45hy75S/NffCgJVQX."
password nil
shell "/bin/bash"
home "/home/#{myuser}"
action :create
end
execute "set #{myuser} passwd to '#{myuser}'" do
command "echo #{myuser} | sudo passwd --stdin #{myuser}"
end
execute "Sync #{myuser}/.ssh with vagrant/.ssh" do
command "cp -ar /home/vagrant/.ssh /home/#{myuser} && chown -R #{myuser} /home/#{myuser}/.ssh"
not_if do
::File.directory?("/home/#{myuser}/.ssh")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment