Linux - GeneralThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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.....
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,
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.