Reputation: 12412
On a precise64 box.
I tried creating a user with Chef using the following declaration:
user "myuser" do
supports :manage_home => true
shell "/bin/bash"
home "/home/myuser"
comment "Created by Chef"
password "mypassword"
system true
provider Chef::Provider::User::Useradd
action :create
end
This succeeds. I can find my user in /etc/passwd
but the home directory wasn't created and I can authenticate.
$ su - myuser
su: Authentication failure
What am I missing?
Found a similar thread here
Upvotes: 0
Views: 720
Reputation: 2372
Chef hashes the password. Below bypasses it.
passwd=%x( openssl passwd -1 'mypassword' )
passwd.delete!("\n") # removes \n from string
user "myuser" do
manage_home true
shell "/bin/bash"
comment "Created by Chef"
password passwd
system true
provider Chef::Provider::User::Useradd
action :create
end
Upvotes: 0
Reputation: 796
Try the following
openssl passwd -1 "mypassword"
Password $1$YwUKq1QX$qIVeFlybWqOKJjRLed29j
user "myuser" do
supports :manage_home => true
shell "/bin/bash"
home "/home/myuser"
comment "Created by Chef"
password $1$YwUKq1QX$qIVeFlybWqOKJjRLed29j.
system true
provider Chef::Provider::User::Useradd
action :create
end
Upvotes: 3