I earlier queried about the-p option of useradd.  After realising that -p
need the encrupted passwd I thought I had had it solved.  However, it is
not working.  I am curious to a few points and I will try to explain it as
breifly as possible.

1) I need to add MD5 passwds all in one shot.
2) the command string looks like this:

useradd -g mailusers -d /email_dirs/n/newuser -p
$1$U9BZsc8v$84Kz5LPldJz.Rzgxm8oI71 newuser

However, useradd only passes the last 21 digits into /etc/shadow

newuser:4Kz5LPldJz.Rzgxm8oI71:10939:0:99999:7:::

3) MD5 passwords are enabled.  If I set the passwd seperatley, (above
passwd is qwer1234, and is a valid MD5 passwd) it will make an MD5 passwd:

root@gradishar /tmp]# passwd newuser
Changing password for user newuser
New UNIX password:<qwer1234>
Retype new UNIX password:<qwer1234>
passwd: all authentication tokens updated successfully

/etc/shadow:

newuser:$1$nCYfNe8b$HoPOs4KzQCDaB63KCYqW..:10939:0:99999:7:-1:-1:134538444
(note* the below works too as they are same pw, different salts)
newuser:$1$U9BZsc8v$84Kz5LPldJz.Rzgxm8oI71:10939:0:99999:7:-1:-1:134538444

4) here is another quirky thing, the -p option is not even documented in
my useradd  >man useradd:

USERADD(8)                                             USERADD(8)

NAME
       useradd - Create a new user or update default new user information

SYNOPSIS
       useradd [-c comment] [-d home_dir]
               [-e expire_date] [-f inactive_time]
               [-g initial_group] [-G group[,...]]
               [-m [-k skeleton_dir] | -M] [-s shell]
               [-u uid [ -o]] [-n] [-r] login

       useradd -D [-g default_group] [-b default_home]
               [-f default_inactive] [-e default_expire_date]
               [-s default_shell]

but, it is included in useradd by itself
[root@gradishar /tmp]# useradd
usage: useradd  [-u uid [-o]] [-g group] [-G group,...]
                [-d home] [-s shell] [-c comment] [-m [-k template]]
                [-f inactive] [-e expire mm/dd/yy] [-p passwd] [-n] [-r] 
name
       
       useradd  -D [-g group] [-b base] [-s shell] [-f inactive] [-e
expire mm/dd/yy]


I could not determine what version I have.  However, I am running RH60
Linux gradishar 2.2.5-15 #1 Mon Apr 19 22:21:09 EDT 1999 i586 unknown

Please advise as I need to be able to add users and passwds automatically.

Thanks
David hajoglou

Reply via email to