Score:2

How to open password change dialog from gnome-control-center from the terminal?

cn flag

I can open the User sections by running gnome-control-center but I need to access directly the password dialog box. Is there a way to directly open it?

enter image description here

24601 avatar
in flag
can this not be done by just typing `passwd` in the terminal? [reference](https://thishosting.rocks/change-password-linux-terminal/)
cn flag
It surely can but I need to show graphical dialog hence the requirement.
Raffa avatar
jp flag
Make your own: `echo -e $(zenity --forms --title="Change Password" --text="Password for $USER" --separator="\n" --add-password="Old Password" --add-password="New Password" --add-password="Confirm New Password") | passwd`
Score:0
cn flag

I am not aware of a way to directly open this dialog using a terminal command. You can, however, directly open the "Users" panel in Settings with the command

gnome-control-center user-accounts

from where a single click opens the dialog.

cn flag
Yes, I am aware of `user-accounts` panel but I have an application which runs in Kiosk mode so we don't want the user to access other settings. Is it possible to directly open the password dialog?
vanadium avatar
cn flag
See my answer, which is only my take on it.
mgw avatar
cn flag
mgw
@vanadium is right - `gnome-control-center -l` gives you a list of all directly accessible panels. As best as I can tell password change is not part of this.
starkus avatar
de flag
`gnome-control-center user-accounts --gtk-debug=all` lets you debug the "Users" panel, but I'm not sure if it let's you find a direct link entry...
Score:0
jp flag

You can make your own GUI dialog in a bash script like so:

#!/bin/bash

while true
    do
    input=$(zenity --forms --title="Change Password" --text="Password for $USER" --separator="\n" --add-password="Old Password" --add-password="New Password" --add-password="Confirm New Password")
    [[ "$?" != "0" ]] && break
    echo -e "$input" | passwd && zenity --info  --text="Password for $USER successfuly changed." --no-wrap && break || \
    zenity --forms --title="Change Password Error" --text="Please Enter Valid Password for $USER"
    [[ "$?" != "0" ]] && break
    done

You will need to install zenity if it is not already installed like so:

sudo apt install zenity
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.