/home Subdirectories

Hello:
Could someone please explain to me how to create a subdirectory in the /home directory. I have tried creating a new user but the default path for a new user is /export/home. I am running Unix 5.8 on a Sun Blade 100. Thanks.

You need to be root to do this most likely.

Go into /home and do mkdir username to create the new directory for your new user.

Then you need to specify /home/username as the user's home dir when you create the account. I'm not sure how you're doing the account creation, but both the useradd command and the graphical admintool let you specify the home directory path.

Or you could just edit your /etc/passwd file and put the correct home directory entry in for that user once you have the new dir created.

Don't forget to change the ownership of the dir with chown so that the new user owns his home directory. I've done that before and then the user can't access it. Oops.

/home is controlled by the auto-mount daemon and should be used for NIS/NIS+ networks. to use /home delete the entry of your /etc/auto_master and restart /etc/init.d/volmgt

greetings PRESSY

Thanks for the answers. I fixed the mounting of the home directory like Pressy suggested and it worked like a charm. Thanks again!!!

Nice catch Pressy.

I wasn't thinking about the automounter since he mentioned it was a sun blade 100. I assumed (incorrectly it turns out) he was talking about a standalone machine not one on a NIS network.

I would have just done this as root:
# useradd -d /home/<userID> -m -s /bin/ksh <userID>

This would create the home dir in /home/<userID> with the correct user rights.

In Solaris 8 (i.e. SunOS 5.8 - there is no such thing as "unix 5.8"), /home by default is owned by the automounter, wether or not you have NIS installed. Pressy's solution above is the only way to make the automounter let go of /home. There is no way to create any subdirectories in /home unless you make the automounter let go.

In Solaris, useradd does not create home directories for you.

Garry, it's true what you have said about the /home directory. I normally would use /export/home/<userID>
Unfortunately you are not correct about the creation of a home directory by useradd.
the -d will asign/direct useradd to what ever path you put there, the -m will make that path and make the userID owner.

I stand corrected about useradd. Was the "-m" something that has been added at some point? Sometimes I'm operating off of an old man page. Sometimes I don't bother learning a flag if it only works on specfic O.S.es (AIX, Solaris, Linux). For example, "df -l" works on Solaris; but because I get used to living without it on AIX, I sometimes forget it is there on Solaris.