sudo useradd wont make home directory

284 views Asked by At

I have an automatic script which works, only it just never makes a home directory. The data is extracted from a database.

Heres the script:

$SQL -s -e "SELECT uid, password FROM registrations WHERE processed = 0"   \
|  while read A B; do
        sudo useradd   $A -p $B -m /home/

as you can see the -m is there, but it seems to ignore it and never make a home directory and I have no idea why. I must be missing something but i've no idea what

1

There are 1 answers

2
Mosty Mostacho On

If you run man useradd you'll see that the -m does not expect a parameter.

Running it this way should do the trick (or at least it just did on my Debian Squeeze):

useradd $A -p $B -m

In the man pages you'll also find other useful options such as: -d or -b