Wednesday, September 3, 2014

[Quick Tips] : Reset or create user and its password by bash script

Reset or create user and its password by bash script

Reset or create user and its password by bash script
I would like to share these small one liner and it is quite good for Linux System Admin who wants to know how to reset passwd with bash script.
Example 1: In this eg. we will create new user and set the passwd.
UserName : test
Passwd : test123
#!/bin/bash
useradd test;echo test123|passwd test –stdin
Example 2: In this example we will reset the passwd.
Username: linuxtribe
Passwd : sort_1t_out
#!/bin/bash
echo sort_1t_out|passwd linuxtribe –stdin
Note: The script starts from #!/bin/bash

No comments: