Operating System - HP-UX
1821051 Members
2420 Online
109631 Solutions
New Discussion юеВ

can not create user HOMEDIR

 
SOLVED
Go to solution
tom quach_1
Super Advisor

can not create user HOMEDIR

Hi all,

i have some wear problem and need your help.
when i create new user, it always create user in root DIR, even in
/etc/default/useradd, i have a HOMEDIR
#default useradd options
HOMEDIR /home
#HOMEDIR /SUNHOME
GROUPID 20
INACT -1
EXPIRE
CHOWN_HOMEDIR no

and permision of /home is 777
as root i can cd to /home and mkdir with out a problem.


the server has been in service 3 yrs and never has problem like this before.

Thanks in advance.
Regards,
Tom
13 REPLIES 13
Raj D.
Honored Contributor

Re: can not create user HOMEDIR

Tom,

What happens if you try to provide the home directory from command prompt ,

Ex: # useradd -U -d/home/user1 -s/usr/bin/sh -g -m user1

Btw, what is version of the OS.


Cheers,
Raj.
" If u think u can , If u think u cannot , - You are always Right . "
Sandman!
Honored Contributor

Re: can not create user HOMEDIR

Could you post the command you use for adding users on your system.
tom quach_1
Super Advisor

Re: can not create user HOMEDIR

Thanks Raj

The os=HP-UX 11.11

if I use command line like this,
then user was created successful.
useradd -m -d /home/testuser testuser


if I use command like this
useradd -m testuser

it would create user in root as /testuser


Thanks,

Sandman!
Honored Contributor

Re: can not create user HOMEDIR

The useradd command is behaving as it should, since the "-m" option does not take an argument but the "-d" option does, and is the dir you specify on the command line.

>useradd -m testuser

the command above will create dir /testuser since the default for the "-d" option is base_dir/login. See the man page for useradd(1M) for details and read the text for the "-d" option.

~cheers
Raj D.
Honored Contributor

Re: can not create user HOMEDIR

That means it is not picking up the default configurations from the /etc/default/useradd file. And looks like a weired bug on hpux 11.00 and 11.11, Btw, did you checked with the option -D .


Though not have much idea at this point of time,

But you can check this thread as well:
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1012891&admit=-682735245+1167170130569+28353475

Cheers,
Raj.





" If u think u can , If u think u cannot , - You are always Right . "
Raj D.
Honored Contributor

Re: can not create user HOMEDIR


useradd -m option will create the directory automatically , as per the username specified. ( As mentioned above by Sandman!. )

Cheers,
Raj.
" If u think u can , If u think u cannot , - You are always Right . "
tom quach_1
Super Advisor

Re: can not create user HOMEDIR

thank you Raj and sandman,

this box has been working for the last 3 years and this just happens last few weeks.

the command
#useradd -m testuser will create user in default home DIR " /home"
somehow it did not pickup the default in this file.
/etc/default/useradd
for now, i just add -d in the script. but if someone has any idea
please let me now,
Thank you,
Tom
Sandman!
Honored Contributor

Re: can not create user HOMEDIR

could uou post the output of the command below:

# useradd -D

thanks!
James R. Ferguson
Acclaimed Contributor
Solution

Re: can not create user HOMEDIR

Hi Tom:

Try removing the commented line ("#HOMEDIR /SUNHOME") from the defaults file and reissue the 'useradd' command the way you have been using it.

Regards!

...JRF...
Sandman!
Honored Contributor

Re: can not create user HOMEDIR

Remove the #HOMEDIR /SUNHOME line in your useradd file and run the "useradd -D" command before and after deleting the offending line and you'll see why that's the case.

~hope it helps
tom quach_1
Super Advisor

Re: can not create user HOMEDIR

Thank you very much,
it works well after removed the line.

Would someone please explain as why that comment line would cause the problem?

Thanks,
Tom
James R. Ferguson
Acclaimed Contributor

Re: can not create user HOMEDIR

Hi (again) Tom:

> Would someone please explain as why that comment line would cause the problem?

Certainly. Clearly, the presence of the pound sign character is not interpreted as indicative of a comment line that should be skipped. Hence, the last declaration for the keyword HOMEDIR was processed and since '/SUNHOME' doesn't exist, the variable's value became a default of root's home directory.

Regards!

...JRF...
tom quach_1
Super Advisor

Re: can not create user HOMEDIR

Thank-you James for you explanation.


Regards,
Tom