I'm trying to force a newly created user to change a password at the first time login using ssh. For security reasons I want to give him a secure password until he logs in for the first time. I did the following so far:
useradd -s /bin/bash -m -d /home/foo foo passwd foo
chage -d 0 foo only gives me the the error
Your account has expired; please contact your system administrator on ssh login.