PASSWD PASSWOR AS A PARAMETER


Few simple example how to no interactive add account and change password.

Change password

 echo -e"new_password\nnew_password" | (passwd user) 

add user and set password

adduser "$1"
echo "$2" | passwd "$1" --stdin

Somtimes stdin didnt work so we can use example nr 1 or chpasswd

adduser "$1"
echo "$2" | passwd "$1" --stdin

that:

adduser "$1"
echo "$1:$2" | chpasswd

or that :

If you want to update your own password as a normal user you may use

echo -e "your_current_pass\nlinuxpassword\nlinuxpassword" | passwd

ps. sometimes working <<<

passwd "$1" <<< "$2"

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s