Page 1 of 2 12 LastLast
Results 1 to 10 of 19

Thread: reboot, shutdown with root?

  1. #1
    Join Date
    May 2017
    Location
    Russia
    Posts
    137

    Default reboot, shutdown with root?

    Hello, was a little surprised with that: reboot, shutdown needs root rights. It's much longer to do that actions or to make shortcuts for them. Can I change them normally to run in user permissions?

    P.S. Is it the finest options to run
    Code:
    shutdown -h now
    or it's better to use another parameters for desktop?

  2. #2
    Join Date
    Nov 2009
    Location
    West Virginia Sector 13
    Posts
    15,654

    Default Re: reboot, shutdown with root?

    Well reboot and shut downs are of course system functions and system functions need system permissions ie root.

    Linux is multi user and you don't want some random user shutting down the hardware.. This is not Windows

  3. #3
    Join Date
    Oct 2014
    Location
    Rotterdam
    Posts
    147

    Default Re: reboot, shutdown with root?

    The funny thing is that for reboot/shutdown on the command line root rights are needed, you can reboot/shutdown using the GUI without explicit root rights, so in the end still a bit like Windows

  4. #4
    Join Date
    May 2017
    Location
    Russia
    Posts
    137

    Default Re: reboot, shutdown with root?

    Quote Originally Posted by gogalthorp View Post
    Well reboot and shut downs are of course system functions and system functions need system permissions ie root.

    Linux is multi user and you don't want some random user shutting down the hardware.. This is not Windows
    Many Linux versions don't need root. It's desktop, not a server and I didn't setup remote connections to it . And another user can use hard reset.

    In OpenSuSE I can't reboot without root but can read system configs like /fstab etc.

    Quote Originally Posted by marel View Post
    The funny thing is that for reboot/shutdown on the command line root rights are needed, you can reboot/shutdown using the GUI without explicit root rights, so in the end still a bit like Windows
    yes but I can't use it with parameters like timer. And they are often have a long delay (or I need to close most apps before it).

  5. #5

    Default Re: reboot, shutdown with root?

    Use:
    Code:
    systemctl reboot
    or
    Code:
    systemctl poweroff
    That's what the GUIs do in the end.

    The reboot and shutdown commands always needed root privileges.
    systemctl respects the polkit settings, which are defined to allow it for locally logged-in users by default (if the system security level is set to "easy").

  6. #6
    Join Date
    May 2017
    Location
    Russia
    Posts
    137

    Default Re: reboot, shutdown with root?

    Quote Originally Posted by wolfi323 View Post
    Use:
    Code:
    systemctl reboot
    or
    Code:
    systemctl poweroff
    That's what the GUIs do in the end.

    The reboot and shutdown commands always needed root privileges.
    systemctl respects the polkit settings, which are defined to allow it for locally logged-in users by default (if the system security level is set to "easy").
    Ok but I can't find how to add delay

  7. #7

    Default Re: reboot, shutdown with root?

    Quote Originally Posted by psijic View Post
    Ok but I can't find how to add delay
    Something like this then maybe?
    Code:
    sleep 5s; systemctl poweroff
    Or maybe have a look at kshutdown:
    https://kshutdown.sourceforge.io/
    (available in the standard repos)

    Another option would be to use sudo and sodoers to run reboot or shutdown as user.
    Last edited by wolfi323; 11-Jun-2017 at 13:11.

  8. #8
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    24,890

    Default Re: reboot, shutdown with root?

    Quote Originally Posted by marel View Post
    The funny thing is that for reboot/shutdown on the command line root rights are needed, you can reboot/shutdown using the GUI without explicit root rights, so in the end still a bit like Windows
    It is still root that does the shutdown, but the end-user is not asked for the root password.
    That is a hole in the security and that hole is in this case made by Policykit I assume.
    And that hole is made on purpose to give the end-user an MS Windows feeling
    Henk van Velden

  9. #9

    Default Re: reboot, shutdown with root?

    Quote Originally Posted by hcvv View Post
    It is still root that does the shutdown, but the end-user is not asked for the root password.
    That is a hole in the security and that hole is in this case made by Policykit I assume.
    No, rather by the default polkit settings/rules in openSUSE.

    It's configurable though, by root.

    And the system security settings in /etc/sysconfig/security affect this, i.e. set it to "secure" and no user will be able to shutdown/reboot.

    Btw, if another user is logged in at the same time, you will be asked for the root password anyway, with the default "easy" settings.

    And that hole is made on purpose to give the end-user an MS Windows feeling
    Or to make the (Linux) desktop more usable to end-users.
    Why should you have to enter the root password on a single-user desktop system anyway?

    And the user has been able to shutdown/reboot a (open)SUSE (or even SuSe) system via the GUI since ever I am using it... (although polkit didn't exist back then)
    Last edited by wolfi323; 11-Jun-2017 at 13:27.

  10. #10
    Join Date
    May 2017
    Location
    Russia
    Posts
    137

    Default Re: reboot, shutdown with root?

    Hm, when I reboot/shutdown using the GUI, the system is going to logout screen, not goes reboot/shutdown

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •