Chpasswd error

Markus Schönhaber ubuntu-users at list-post.mks-mail.de
Tue Jan 19 10:45:40 UTC 2010


19.01.2010 11:16, shali Kallumpuram:

> i have script called createstaff.sh ,in that script chpasswd not working if
> i run
> echo "usename:passwd" | chpasswd
> its working,
> 
> what is the problem??

The problem is, that in your script, you're doing something entirely
different than what you do above:
[...]
|    echo $username:$password >> /root/Desktop/programming_lab/tp
[...]
| chpasswd /root/Desktop/programming_lab/tp;

The chpasswd command reads a list of user name and password pairs from
standard input, but you provide nothing as standard input to chpasswd in
your script.
Try
| chpasswd < /root/Desktop/programming_lab/tp
instead.

BTW: what are those ';' you terminate some lines with intended to do?
You're writing a shell script, not C code.

-- 
Regards
  mks




More information about the ubuntu-users mailing list