Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue modifying ssh keys for root users #42

Open
nicolasccit opened this issue Jun 17, 2013 · 2 comments
Open

Issue modifying ssh keys for root users #42

nicolasccit opened this issue Jun 17, 2013 · 2 comments

Comments

@nicolasccit
Copy link

When I want to create a new user like so:

user_account 'new_user' do
  ssh_keys "ssh-rsa ..."
  action :create
end

Everything works as planned.

But when I try the following:

user_account 'root' do
  ssh_keys "ssh-rsa ..."
  action :modify
end

I get the following error:

Error executing action modify on resource 'user_account[root]'

Chef::Exceptions::Exec

user[root](/var/chef/cache/cookbooks/user/providers/account.rb line 94) had an error: Chef::Exceptions::Exec: usermod -m -d '/home/root' root returned 8, expected 0

Cookbook Trace:

/var/chef/cache/cookbooks/user/providers/account.rb:105:in user_resource' /var/chef/cache/cookbooks/user/providers/account.rb:46:inblock in class_from_file'

Resource Declaration:

In /var/chef/cache/cookbooks/rollcall/recipes/default.rb

13: user_account 'root' do
14: ssh_keys "ssh-rsa ..."
15: action :modify
16: end
17:

Compiled Resource:

Declared in /var/chef/cache/cookbooks/rollcall/recipes/default.rb:13:in `from_file'

user_account("root") do
action [:modify]
retries 0
retry_delay 2
cookbook_name "rollcall"
recipe_name "default"
ssh_keys "ssh-rsa ..."
username "root"
end

Any idea what I'm doing wrong?

Thanks,
Nicolas

@mckelvaney
Copy link

I had a similar problem when trying to mange authorized_keys for root.
I found that adding home '/root' and manage_home falsefixed things.

My block now looks like this :

user_account 'root' do
    home '/root'
    manage_home false
    ssh_keys ['ssh-rsa key_1', 'ssh-rsa key_2']
    action :modify
end

@eamonnfaherty
Copy link

Thanks for posting your fix @mckelvaney

...I had the same problem too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants