Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9047323
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T11:53:02+00:00 2026-06-16T11:53:02+00:00

I’m using chef-solo with vagrant Chef defaults to root for everything. I want to

  • 0

I’m using chef-solo with vagrant

Chef defaults to root for everything. I want to only use root for a couple of things but use a functional user for everything else.

I’m basically installing a few of packages to standard locations (should be done as root).
And, then I’m compiling a bunch of stuff to a non-standard location. I want this entire tree to be owned by non-root user/group. Can I set the default user/group to an attribute?

More broadly, why does chef want to act as root and why is changing the default user to non-root not a more common request?

Specifically, the bash resource can take a user but this is not a full login of the user. So, the home dir is still root’s home dir (which the user can not write to), the group of files created is still root. So,

bash "foo" do
  user node[:globals][:username]
  code <<-EOH
    # do stuff
  EOH
end

do stuff is not a full login as user.

This question is related to https://serverfault.com/questions/402881/execute-as-vagrant-user-not-root-with-chef-solo and the bug mentioned there that is a won’t fix: http://tickets.opscode.com/browse/CHEF-1523 I guess I need to look closer, maybe at the environment attribute to execute: http://wiki.opscode.com/display/chef/Resources#Resources-Execute

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T11:53:03+00:00Added an answer on June 16, 2026 at 11:53 am

    Most chef resources take a user (or owner) and group attributes to change the default. You can create the directory, setting the owner, group and mode to anything, you can execute (compile?) as a non-root user.

    Check the resources your using for these attributes. It’s possible to store usernames in attributes or environments and then use those values in your recipe resource blocks as the user to run commands or create resources as.

    A good reference for default resources: https://docs.chef.io/resource_directory.html

    ie

    directory '/tmp/what?' do
      owner node[:username]
      group node[:group]
      mode 00755
    end
    

    or

    execute 'gcc somefile.cc' do
      user node[:user]
      group node[:group]
    end
    

    If there’s a specific action you can’t figure out, point it out.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want use html5's new tag to play a wav file (currently only supported
I want to count how many characters a certain string has in PHP, but
I am using the SimpleRSS gem to parse a WordPress RSS feed. The only
I have a French site that I want to parse, but am running into
I want to construct a data frame in an Rcpp function, but when I
I am using JSon response to parse title,date content and thumbnail images and place
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to find ID3V2 tags from MP3 file using jid3lib in Java.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.