Modifying Users - Moving Home Directory


#1

HI All-

I am very new to Chef, and was tasked to create a recipe to move a user’s home
directory. I wrote (what I thought) was a nice little cookbook, with thoughts
of future re-use and expansion…but it did not work as expected. I have now
scaled back to the bare essentials:

default.rb:

user “trip” do
action :modify
home "/NewHome/trip"
supports :manage_home=>true
end

No errors are reported during the run, and the /etc/passwd file correctly shows
the new home location. However, the contents of the original home are not
moved into the new location as I would have expected given the “:manage_home =>
true” attribute. The user is not logged in, no other recipes are run when I
kick it off. If I cp -pR and move the directory manually, it works as
expected. It almost seems if the usermod -d is being used instead of -dm.

Any advice would be appreciated-

Eric


#2

You can see the exact command that gets run with -l debug:

chef-client -l debug

My guess is that you are right, we aren’t running -dm - and if there isn’t a bug for it already, there probably should be, or at least a note on the wiki for the users resource.

Adam


Opscode, Inc.
Adam Jacob, Chief Product Officer
T: (206) 619-7151 E: adam@opscode.com

On Nov 3, 2011, at 6:45 AM, weinig_eric@bah.com weinig_eric@bah.com wrote:

HI All-

I am very new to Chef, and was tasked to create a recipe to move a user’s home
directory. I wrote (what I thought) was a nice little cookbook, with thoughts
of future re-use and expansion…but it did not work as expected. I have now
scaled back to the bare essentials:

default.rb:

user “trip” do
action :modify
home "/NewHome/trip"
supports :manage_home=>true
end

No errors are reported during the run, and the /etc/passwd file correctly shows
the new home location. However, the contents of the original home are not
moved into the new location as I would have expected given the “:manage_home =>
true” attribute. The user is not logged in, no other recipes are run when I
kick it off. If I cp -pR and move the directory manually, it works as
expected. It almost seems if the usermod -d is being used instead of -dm.

Any advice would be appreciated-

Eric