The question asked by K.Chen is: why do I need sudo privileges when I do it from CLI, ahile I do not need such privileges when I do it from the GUI.
The first part of the answer is that people who design Desktop Environments, like Gnome, KDE, Xfce, Mate, Cinnamon, ... try to simplify the work of their users, and they configure shutting down and rebooting without requiring sudo credentials. This, incidentally, implies that there must be a shutdown sequence which does not involve the program shutdown, which does require sudo privileges (no way around that).
I do not know in detail how each DE does it, but I know that there is a gentle way to bring down, or restart/shutdown/hibernate your system, which does not require root privileges. You can find the original post in an Arch Linux Forum post. In essence, it amounts to issuing hese commands:
halt
#!/bin/bash
dbus-send --system --print-reply --dest="org.freedesktop.ConsoleKit"/org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Stop
reboot
#!/bin/bash
dbus-send --system --print-reply --dest="org.freedesktop.ConsoleKit" /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Restart
dbus-suspend
#!/bin/bash
dbus-send --system --print-reply --dest="org.freedesktop.UPower" /org/freedesktop/UPower org.freedesktop.UPower.Suspend
hibernate
#!/bin/bash
dbus-send --system --print-reply --dest="org.freedesktop.UPower" /org/freedesktop/UPower org.freedesktop.UPower.Hibernate
My guess is that the GUI buttons use roughly these commands. To be certain one should look into the code, but I believe this is a safe bet.
Best Answer
Well, Firefox REQUIRES X server. What you would need is to install Firefox with the help of the package management - it should install the bare minimum of the packages, including the X server. Then, you just need to run the X server without the desktop environnment. Basically something like:
Then you just start Firefox in this X server:
You can switch from the X server and the framebuffer by using CTRL+ALT+F1 and CTRL+ALT+F7.
Hope it helps.