I have created a user 'testuser' by using chef. How to make this user as sudo user?
There is a way to modify sudo group by using group
resource:
group "create testuser sudo" do
group_name 'sudo'
members 'testuser'
action :modify
append true
end
Another way is to use sudo recipe https://supermarket.chef.io/cookbooks/sudo .
Recommended way to me is to go with the sudo recipe and offload system specific logic to recipe. There you get attributes resource configurations that makes you recipe code robust.