Reputation: 85
When I order a VPS, I get a random password from them which I need to change.
I basically use CentOS 6 x64.
I was thinking to make a Bash script which when I run will change the password of the VPS to a default common password which I would like to use with all my VPSes.
Is it possible?
I am thinking to use this inside the Bash .sh script. Is my code correct?
#!/bin/bash
passwd
echo jadaruine
If not, what should the code be?
Upvotes: 5
Views: 19782
Reputation: 3143
You can do the following to change the password on CentOS
#!/bin/bash
echo "jadaruine" | passwd --stdin user
Upvotes: 4
Reputation: 246992
You want the chpasswd
command:
sudo sh -c 'echo username:password | chpasswd'
You might also want to look at chage
for password expiry settings.
Upvotes: 10