Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I change home dir when account is created

Status
Not open for further replies.

paladin256

Technical User
Apr 16, 2002
189
US
Right now when I do useradd john it creates the the directory as /home/john. What do I need to change so that when I do useradd john it creates the directory as /export/home/john? Do I modify the profile file in etc?

TIA
 
as root: change the home entry in /etc/passwd for this user. -----------
when they don't ask you anymore, where they are come from, and they don't tell you anymore, where they go ... you'r getting older !
 
Thank you but you misunderstand. I want it so it will default to /export/home when I add users. For example when I do useradd john I want it to automaticly make john in the /export/home directory. I dont want to have to pass additional parameters to it or modify files.

TIA
 
Tia,

You can use the command useradd -D -b /export/home
This will set the default base directory to /export/home
and when the -d option is not specified with the useradd command, the account will add the username argument in the command to the base home directory path (/export/home). See example below...

# useradd -D -b /export/home
# useradd -m -u 3001 user1
#

The result is the creation of user1 with uid 3001 and home directory /export/home/user1

There are other command line options as well. As mentioned previously, you can read the man page to get more specific if you need.

Hope the helps. Good Luck. Have a Great Day!! :)
~Sol
Sys Admin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top