Wednesday, April 22, 2015

How to set a password from command line in linux bash?

If you need to set a password from a command line automatically, you can use the following script:

echo myPassword | passwd myUser --stdin

This will ensure your password is send via pipe into passwd and set appropriately. It can be useful when you need to assign same password on different servers, so you can run this command remotely, over ssh.

No comments:

Post a Comment