# Change password through JSON RPC

**URL:** <https://community.teltonika.lt/t/change-password-through-json-rpc/1209>\
**Category:** Networking Solutions\
**Created:** [August 17, 2023, 1:23pm UTC](https://community.teltonika.lt/t/change-password-through-json-rpc/1209 "2023-08-17T13:23:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon64078327](https://community.teltonika.lt/letter_avatar_proxy/v4/letter/a/a9a28c/32.png) [@anon64078327](https://community.teltonika.lt/u/anon64078327)\
**Post date:** [August 17, 2023, 1:23pm UTC](https://community.teltonika.lt/t/change-password-through-json-rpc/1209/1 "2023-08-17T13:23:41Z")

</div>

Is there a way to change the root and admin passwords through JSON RPC?

I have found some old threads that state that this isn’t possible, but the credentials for the JRPC access seem very high. If i could simple execute this linux command through JRPC that would work:

`echo -e "<yourpassword>\n<yourpassword>" | passwd <user>`

but i am unsure how i should format the JRPC message in order to get a piped command to be run.

I have also tried sending this command, which I found is used in the startup scripts given in the SDK to initialize the passwords:

```auto
set_password() {
	local user="$1"
	local passwd="$2"

	[-z "$passwd"] && passwd="$(mkpasswd admin01)"

	**sed -i -e "s:^$user\:[^\:]*\::$user\:$passwd\::" /etc/shadow**
}

```

this does seem to change the password, but i think it may add an additional password.

Is there a recommended way to use `sed` to change the password, or is sending piped command like above possible?

---

<div class="post-metadata">

**Author:** ![Daumantas](https://community.teltonika.lt/user_avatar/community.teltonika.lt/daumantas/32/29_2.png) [@Daumantas](https://community.teltonika.lt/u/Daumantas)\
**Post date:** [August 18, 2023, 5:52am UTC](https://community.teltonika.lt/t/change-password-through-json-rpc/1209/3 "2023-08-18T05:52:11Z")

</div>

Hello,

In this case, using an `ubus` call will be the easiest way to set the new password. The call itself should look like so:

```auto
{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "call",
    "params": [
        "$sessionid",
        "rpc-sys",
        "password_set",
        {
            "user": "$username",
            "password": "$new_password"
        }
    ]
}

```

Please remember, that for WebUI, user admin is used.  
Hope this helps!

Best regards,

---

<div class="post-metadata">

**Author:** ![system](https://community.teltonika.lt/user_avatar/community.teltonika.lt/system/32/15707_2.png) [@system](https://community.teltonika.lt/u/system)\
**Post date:** [September 1, 2023, 1:23pm UTC](https://community.teltonika.lt/t/change-password-through-json-rpc/1209/4 "2023-09-01T13:23:51Z")

</div>

Closed on September 1, 2023, 1:23pm UTC

This topic was automatically closed after 15 days. New replies are no longer allowed.
