HP-UX user resource and shared homedir

105 views
Skip to first unread message

Martin Alfke

unread,
Aug 9, 2011, 4:27:07 AM8/9/11
to puppet...@googlegroups.com
Hi,

on HP-UX we want some users to have the same homedir.

Homedir is managed by puppet as file resource.

We now want to move the users to another primary group.

useradd.sam complains:

err: /User[XXX]/gid: change from 3 to 0 failed: Could not set gid on user[XXX]: Execution of '/usr/sam/lbin/usermod.sam -F -g 0 XXX' returned 45: Cannot modify user 'XXX': Home directory '/.root_home' is shared
This error also shows up when running the mentioned command on command line.

The following usermod.sam command is working on command line:
'/usr/sam/lbin/usermod.sam -F -d /.homedir -m -g 0 XXX'

How do I add the path and -m option to usermod for HP-UX?

I looked into provider/user/hpux.rb and found:

def modifycmd(param,value)
super.insert(1,"-F")
end

so I thought to add the required parameters:

def modifycmd(param,value)
super.insert(1,"-F -d "+home+" -m")
end

But this leads to another error message:

err: /User[XXX]/gid: change from 3 to 0 failed: Could not set gid on user[XXX]: Execution of '/usr/sam/lbin/usermod.sam -F -d /.homedir -m -g 0 XXX' returned 2: Unrecognized Option ' '
Usage: usermod.sam [-p <passwd> [-u <uid> [-o]] [-g <group> [-G <group>[,<group...> [-d <dir> [-m]] [-s <shell>] [-c <comment>] [-f <inactive>] [-e <expire>] [-l <new logname>] <login>

When using the above command with copy and paste everything is working as expected.

Any help?

Regards,

Martin

Martin Alfke

unread,
Aug 9, 2011, 7:24:00 AM8/9/11
to Puppet Users
Solution:
in type/user/hpux.rb:

def modifycmd(param,value)
# super.insert(1,"-F")
cmd = [command(:modify)]
cmd << "-F"
cmd += add_properties
if @resource[:allowdupe]
cmd << "-o"
end
cmd << @resource[:name]
end
end

Any suggestions whether this change should be done better?

Regards,

Martin
Reply all
Reply to author
Forward
0 new messages