Changing a password with one command in FreeBSD

5.4k Views Asked by At

How can I, as a simple user, change my own password with one command (in one line) in FreeBSD. I tried using passwd --stdin but that seems like it's a Linux command only.

2

There are 2 best solutions below

2
On

Just type passwd and follow the prompts.

Also man 1 passwd for documentation.

Update with a copy of my comment, below, from September 2013:

The whole point about passwd is to make that hard for automated password changers to guess passwords. If you have a port like expect on the system you could script it. If you are root, you could use pw usermod username -h0. If you're just an ordinary user, just do it interactively.

0
On

Use the pw command to take input from STDIN like this:

echo "mynewpassword" | pw usermod admin -h 0

See man pw for more details.