I've spun many boxes in the cloud before, but was growing tired of going through the same dance; and as I'm trying to get familiar with Chef, I figured, that's a good use case to do a little learning.
Ah, that feeling when you think you know how it'll work - but it doesn't. Since I'm new to Chef, I suspect I'm not doing something right in this recipe, which is like my 2nd ever. NOTE: I understand there probably are 'cookbooks' out there that do something like that, but at this point I'm trying to build some ver basic knowledge with the simplest approach.
user 'foox' do comment 'test me' uid '6711' home '/home/foox' shell '/bin/bash' password '<password_shadow_here>' end directory "/home/foox" do owner "foox" group "foox" mode 00755 action :create end directory "/home/foox/.ssh" do owner "foox" group "foox" mode 00600 action :create end file '/home/foox/.ssh/authorized_keys' do owner "foox" group "foox" mode "00600" content IO.read('/root/.ssh/authorized_keys') action :create end
Now, this does create the user with a password and home folder with .ssh, and copies the public key from root's own file. But this system ends up failing to let me log in --
Permission denied (publickey) -- when using the same private key as what I have as my root's. But, well, root user wasn't created by my recipe. And if I create my own user manually, it's working fine.
I guess there's something missing in my recipe, then?