LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-07-2013, 06:45 PM   #1
sniper8752
Member
 
Registered: Oct 2012
Posts: 340

Rep: Reputation: Disabled
create home directory


How do I create a user's home directory (given the assumption that I am already logged into the user's account, or from the root account)?
 
Old 02-07-2013, 06:49 PM   #2
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,362

Rep: Reputation: 2001Reputation: 2001Reputation: 2001Reputation: 2001Reputation: 2001Reputation: 2001Reputation: 2001Reputation: 2001Reputation: 2001Reputation: 2001Reputation: 2001
Are you referring to a user that has been created, but does not currently have a home directory? It's generally best to use the -d flag in useradd to automatically create the user's home directory when the user is added.

Anyway, you should be able to make the directory as root with a simple mkdir and setting the appropriate permissions (700, user:group). You may also want to copy in some dummy initialization scripts as well to give the user something to work off of (.bashrc, .bash_profile, etc.).

Last edited by suicidaleggroll; 02-07-2013 at 06:50 PM.
 
1 members found this post helpful.
Old 02-07-2013, 07:06 PM   #3
sniper8752
Member
 
Registered: Oct 2012
Posts: 340

Original Poster
Rep: Reputation: Disabled
i forgot to use it when creating the user. isn't there a chmod user command that will use -d?
 
Old 02-07-2013, 07:12 PM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,260

Rep: Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328
You mean usermod http://linux.die.net/man/8/usermod
 
Old 02-07-2013, 07:13 PM   #5
sniper8752
Member
 
Registered: Oct 2012
Posts: 340

Original Poster
Rep: Reputation: Disabled
I type in "usermod -d /home/username username". i am logged in as root.
i then get a message saying: "usermod: no changes".
 
Old 02-07-2013, 07:17 PM   #6
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,260

Rep: Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328
Did you add the -m switch as indicated in the man page?
Besides, this is really for changing an extant user's details. It may be easier to do it manually as per suicidaleggroll's post.
Try each one and double check the results, both the dir and the /etc/passwd entry
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
useradd: cannot create directory /home/ amirzkria Red Hat 5 08-07-2014 10:11 AM
samba and pam.d create a home directory sal_paradise42 Linux - Networking 0 04-08-2009 06:51 PM
create a new user with a different home directory cccc Debian 6 08-06-2008 06:47 AM
how to create a new partition for current /home directory? parv Linux - Hardware 3 02-27-2007 10:21 AM
home directory auto create problem bobthehorrible Linux - Networking 2 10-13-2005 10:54 AM


All times are GMT -5. The time now is 06:14 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration