how to force "machinectl shell" or systemd-run to ask for password in terminal instead of dialog window?
I can run a command as root using:
machinectl shell --uid=root --setenv='DISPLAY=:1.0' --setenv=SHELL=/bin/bash .host /bin/bash -lc 'startxfce4'
but it ask for the password using the dialog window
I want to have the same behavior of sudo (sudo ask for the password using the terminal so I can script it easily)
on way I found is using ssh like that:
ssh -t MyActualNormalUser@localhost
then run the same command as above:
machinectl shell --uid=root --setenv='DISPLAY=:1.0' --setenv=SHELL=/bin/bash .host /bin/bash -lc 'thunar'
now machinectl ask for the password using the terminal instead of the GUI dialog window!
How can I achieve the same result without using ssh? is it possible to force machinectl/pkexec to ask for the password in the terminal?
why not use sudo? sudo do not create a new session for the command I run , machinectl run a totally separated session which make life in scripting easier. and as I read machinectl/pkexec are the su/sudo replace if I m not wrong...