Reputation: 537
I want to run the chef-client as a test user in my linux machine. For that, I add cache path in the client.rb file which is from /etc/chef/client.rb.
cache_path "~/.chef/cache"
Then I run the chef-client command from test user(non-root user).It shows error?
Chef encountered an error attempting to create the client
How to setup the cache-path? Is is necessary to move the client.rb,chef-validator.pem, client.pem, first-boot.json under test user?
Upvotes: 2
Views: 3942
Reputation: 15784
First of all, chef is intended to be run as root. A lot of resources assume they're run as root, and need it. They will fail if not running as root.
For your error specifically, your test user has no right to write a file in /etc/chef
(default location) and it need to write the client.pem
node certificate.
Some ideas:
/etc/chef
to your test usersudo
to run chef client with a test user (need an entry in sudoers file)client.rb
file to point client_key
to your test user home directory/etc/chef
Upvotes: 3