I am trying to automate setting up a user on centos as part of my script. Here is what i am doing:-
/usr/sbin/useradd my-user
/usr/bin/passwd my-user
You will be be prompted to enter password for the my-user user
Now is there a way to skip the second command so that there is no manual prompt, so that i can have something in the script to auto create my-user on centos without needing to manually enter the password
2
Answers
You can change password programmatically, using:
You can use chpasswd command with echo. Here is a simple example