> For the complete documentation index, see [llms.txt](https://til.devjugal.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://til.devjugal.com/linux/changing-user-password-in-shell-script.md).

# Changing User Password In Shell Script

In order to change in shell scripts, we have two options which are given below.

## Option 1

Using `passwd`

```bash
echo -e "{NEW_PASSWORD}\n{NEW_PASSWORD} | passwd {USER}
```

## Option 2

Using `chpasswd`

```bash
echo "{USER}:{NEW_PASSWORD} | chpasswd
```

***Source:*** [***StackOverFlow***](https://stackoverflow.com/a/11787889)
