- echo “123” | passwd -stdin lamp
- echo testuser:password|chpasswd
Reference: Linux does not need to change the password interactively by Shell script command
It should be noted that this is not the way to set a password security, after the re-use, remember to clear your history, or likely to leak.