I'd like to execute a command on a remote vm that creates a user and specifies their password.
using sshpass, I can remotely execute commands as root, e.g.
sshpass -p "rootpasswd" ssh root@remotevm '<remote command here>'
So I want to create a user, which I can do with
adduser <username>
Next I want to use usermod to create a password:
usermod --password <encrypted_pass> <user>
I want to be able to specify the password bananas - so how can I encrypt the string bananas so that I can specify bananas as the encrypted password for the user?
As root, you can set a password for the user:
passwd username
Try chpasswd
:
echo "user:password_here" | chpasswd
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With