Sample Header Ad - 728x90

sudo equivalent in systemd

9 votes
2 answers
3536 views
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 enter image description here 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! enter image description here 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...
Asked by Badr Elmers (522 rep)
Oct 6, 2019, 12:10 AM
Last activity: Oct 9, 2019, 07:45 AM