Hi All,
Here is a very strange problem that I have been fighting with for weeks and am clueless to what is happening.
I have a php script that writes a file with username:passwd on each line. Once this file is created I can run another PHP script that loops through the file, does useradd on each username then calls the following function:
cat /path/to/file | chpasswd
So now I have new users and passwords assigned. This all works fine as long as I run the script to create users and set passwords as root. As this is not possible in production state for security reasons I setup a cronjob to run every 5 mins. The problem is when run as a cronjob (as root) the user is created but the password is not and the account is locked!
I have tested and tested, if I use the command in the crontab from the command line manually it works but as a cronjob it fails!!
Please help me as I am about to lose the plot!!
TIA
Phil.