I recently need a command line to shutdown my computer after the last songs of a playlist ended. I don’t want to change the right of the shutdown programm and put a sécurity hole.
So, how can I shutdown my computer as a normal user with command line without confirmation dialog box?
For xfce:
xfce4-session-logout --halt
For Gnome:
gnome-session-quit --power-off --force --no-prompt
for KDE (not try):
DISPLAY=:0 qdbus org.kde.ksmserver /KSMServer logout 0 0 0
or
kshutdown -h
kshutdown seems to get a dialog box; someone could confirm?