Use -p flag for useradd instead of running sed on /etc/shadow.