LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 08-09-2002, 12:11 PM   #1
abrakadabra
Member
 
Registered: Apr 2002
Location: Denver
Distribution: SuSe,RedHat,Mandrake,
Posts: 109

Rep: Reputation: 16
adding a new user doesn't create a home directory


It all started after I used the usermod command to modify the login for a user. User johnDo (fictitious for security reasons) was logged-in , I su - root to modify the login from johnDo to johnDoe using

#usermod -l johnDoe johnDo.

No problems so far. Then, for consistency reasons, I went ahead and modified the user's home directory from /home/johnDo to /home/johnDoe. I exited out of the root session, logged out as johnDo and logged back in. Then, I found out that to perform this operation one needs to be LOGGED-OUT from the user to be modified, or the system "gets confused", too late for this!. From then on every time I create a user, all the records are fine in the passwd file. My useradd -D are correct but the home directory for any user I'm adding does not get created. I hope that someone can post some ideas as to where to begin to triage this.

Thanks in advance.

 
Old 08-09-2002, 12:17 PM   #2
MartBrooks
Member
 
Registered: May 2002
Location: London
Distribution: Debian
Posts: 388

Rep: Reputation: 31
mkdir /home/<username>
chown <username>.<usergroup> /home/<username>

Regards
 
Old 08-09-2002, 01:15 PM   #3
abrakadabra
Member
 
Registered: Apr 2002
Location: Denver
Distribution: SuSe,RedHat,Mandrake,
Posts: 109

Original Poster
Rep: Reputation: 16
Hi MartBrooks,

That is what I did as a workaround to get the user going and it's working fine. But my problem is that for every new user I create I have the same problem, and need to do this process again to create their directory, change owners, etc...
This wasn't happening before.....

Thanks.
 
Old 08-09-2002, 05:00 PM   #4
realos
Member
 
Registered: Jul 2002
Location: Germany
Distribution: Redhat 7.3, Debian 3.1, Knoppix 3.1, Ubuntu 6.10
Posts: 113

Rep: Reputation: 15
please look in the file /etc/defaults/useradd there you can give the defaults if and where, for expample, home directory should be created etc....

can you give the output of the file and what distro you are using?...


regards
 
Old 08-09-2002, 05:05 PM   #5
pk21
Member
 
Registered: Jun 2002
Location: Netherlands - Amsterdam
Distribution: RedHat 9
Posts: 549

Rep: Reputation: 30
If you cant find a solution then just build a script and give it an alias.
This will speed up the whole process.
 
Old 08-09-2002, 05:23 PM   #6
realos
Member
 
Registered: Jul 2002
Location: Germany
Distribution: Redhat 7.3, Debian 3.1, Knoppix 3.1, Ubuntu 6.10
Posts: 113

Rep: Reputation: 15
hi,

my mistake in the last posting ...

read the man pages of useradd and you will see that by default there is no directory created. you should add the option -m to the command-->> useradd -m newuser and you will be fine,

take care
 
Old 08-09-2002, 08:11 PM   #7
abrakadabra
Member
 
Registered: Apr 2002
Location: Denver
Distribution: SuSe,RedHat,Mandrake,
Posts: 109

Original Poster
Rep: Reputation: 16
Hi realos,

thanks for the input. I looked at the man pages for useradd did some testing using the -m flag and the directories are getting created. I still think that something happened when I used usermod logged in as the user to be modified. Actually when a user is added and no flags are passed to the useradd command, the defaults in useradd -D are created in my case is:
GROUP=100
HOME=/home
INACTIVE=0
EXPIRE=10000
SHELL=/bin/bash
SKEL=/etc/skel
I tested useradd on other machines same version ( SuSE 7.2) and the user's home directory are created by default just fine.
e.g

# useradd testing

if I su - testing
then cd
then pwd

I get .....

/home/testing

notice I did not specified -m

any way in the broken PC using -m works fine. From here I'd like to figure out what might've got broken.

pk21 thanks for the idea of creating a script I'm sure this can be a good resource when things get really bad.

Anyway thank you both for the input.
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
user home dir doesn't create when new user add dev_mohamed Linux - Software 3 01-12-2007 01:08 AM
home directory auto create problem bobthehorrible Linux - Networking 2 10-13-2005 09:54 AM
create ftp user for vsftpd server without home directory cccc Linux - Networking 2 07-30-2005 06:32 AM
HELP! When I create a new user a home dir isn't created lynchpin9 Linux - General 5 01-18-2005 11:05 AM
adding /bin to /home/user emetib Linux - General 9 04-06-2004 06:25 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 07:33 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
Open Source Consulting | Domain Registration