Link to home
Start Free TrialLog in
Avatar of tzk
tzk

asked on

How to use 'usermod' command to add user's login directory

hi, everybody:
    When I created a new user account with useradd command, I found the user directory was not created, because I didn't use any options in the useradd command. Now, I want to add the new user's login directory with 'usermod' command. But it doesn't work, look:

   sudo usermod -d /home/newuser newuser
   sudo usermod -d -m /home/newuser newuser
 
   The commands above don't work, The directory wasn't created. How should I do?
ASKER CERTIFIED SOLUTION
Avatar of frashii
frashii

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of tzk
tzk

ASKER

frashii:
    Thank you very much! And do you mean that the 'usermod' doesn't complete the tasks you said above? I want to know if 'usermod' can do it.
Very odd.. I would have expected both of those commands to work!

What version of Linux is it ? Ubuntu ? Redhat? Debian ?
Avatar of tzk

ASKER

I use Ubuntu.

I thought the 'usermod -d -m' command should create the user's login directory and environment. I just don't understand this.
Does /home exist already ? ie. are you trying to create 2 levels of directories ?

You are entirely correct, that should work EXACTLY like that