1847301 Members
2468 Online
110264 Solutions
New Discussion

Re: useradd question

 
SOLVED
Go to solution
dictum9
Super Advisor

useradd question

I need to add a few users all with a pre-existing (and the same) home directory. How do I do that?

I used the -d flag but it complains about -m and -k flags. When I remove the latter, it doesn't work either.
5 REPLIES 5
Pete Randall
Outstanding Contributor
Solution

Re: useradd question

The following works for me:

useradd -g 20 -d /home/plr newuser
# grep newuser /etc/passwd
newuser:*:119:20::/home/plr:/sbin/sh


Pete

Pete
A. Clay Stephenson
Acclaimed Contributor

Re: useradd question

useradd -u 9977 -g mouse -d /home/mickey minnie

The "gotcha" is that the existing home directory, /home/mickey, must have group "mouse" and be readable and searchable by group "mouse".
If it ain't broke, I can fix that.
James R. Ferguson
Acclaimed Contributor

Re: useradd question

Hi:

The 'useradd' manpages note that "the directory which will be shared should have read and execute permissions for the group. Otherwise, useradd will report an error."

Does your directory meet that criteria? What error (exit value) does 'useradd' report?

Regards!

...JRF...
Steven E. Protter
Exalted Contributor

Re: useradd question

Shalom,

You could set up an alternate set of profiles in /etc/skel, perhaps /etc/skel2 and use skel2 as instead of the default.

That should get past any errors you encounter now.

Which version of HP-UX do you use?

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
dictum9
Super Advisor

Re: useradd question

Using the -g switch worked nicely.. thank you.