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

Thread: Question regarding linux shutdown

  1. #1

    Question regarding linux shutdown

    Can ny1 explain why an ordinary user can shutdown the system in GUI, but cannot do the same from command line

  2. #2
    Senior Member tampabay420's Avatar
    Join Date
    Aug 2002
    what flavor (distro) of Linux are you using?
    on my system, only admin accounts can shutdown...
    yeah, I\'m gonna need that by friday...

  3. #3
    Senior Member
    Join Date
    Sep 2001
    I've seen this on redhat i believe.. kinda scary.. I was in a hurry at the time so i didn't explore why or how to stop it, but maybe i'll get some time to experiment..

  4. #4
    Join Date
    Jul 2001
    If you are referring to RedHat 8 (which is what I use), you can disable that option by going to control center -> system -> login manager

    Then you switch to administrator mode which requires the root password and click on the tab that says Sessions. Here you can choose to only allow root to shutdown and reboot or (the default) to allow everyone.

    I think that is written to the file /etc/X11/xdm/kdmrc but this is the gui route to do what you are looking for.


    It\'s a long life, until you die

  5. #5
    Junior Member
    Join Date
    Feb 2003
    This is likely because the shutdown command is not in your path.
    The path to the shutdown is usually:


    For example a regular user on my system (Mandrake 9.0) has the following PATH:


    Check your PATH by running thr following command:

    echo $PATH

  6. #6
    Join Date
    Jul 2001
    StormCr0w true sbin isn't in the normal user's path, but I actually tried to run it today to check that and it still wouldn't let me run it even though I "World" had read-execute permissions on it. Go figure. Anyway, the command the the login screen menu runs is called /sbin/poweroff (which is a link to /sbin/halt) and /sbin/reboot.

    All of these only let you run them if you are root. But......since mingetty (login manager or window manager, something like that) runs as root, I am assuming that the command is executed as root.

    That is the best explanation I can give according to my understanding (guess work). BTW I don't know this for fact, it is just my opinion. This post intrigued my interest so I decided to look into it. But if anyone else has a better explanation I would certainly welcome it.

    It\'s a long life, until you die

  7. #7
    Antionline's Security Dude instronics's Avatar
    Join Date
    Dec 2002
    Hello oxygen.

    I think this link HERE will solve your problem.

    Your solution is called Sudo.

    This is an excellent example of what sudo can be used for. I think its wise that a normal user cannot shut down in command mode. With sudo, you can

    That way you dont have to mess with your paths and/or permissions.

    Ubuntu-: Means in African : "Im too dumb to use Slackware"

  8. #8
    if u have logged in with an admin account you can shutdown with command shutdown -y now
    this command works on RH 8.0

  9. #9
    Leftie Linux Lover the_JinX's Avatar
    Join Date
    Nov 2001
    Beverwijk Netherlands
    If you use KDM as a login thing.. root can change the settings so that noone but root can reboot or shutdown (not even from GUI)..

    The option can be found in the KDE config thingy.. (/me is on windows atm.. sorry)
    ASCII stupid question, get a stupid ANSI.
    When in Russia, pet a PETSCII.

    Get your ass over to SLAYRadio the best station for C64 Remixes !

  10. #10
    I really appreciate all those replies, some are close to what am trying to figure out.

    I think I need to make my question little more clear.

    I have RH7.2 server installation. So if I add a new user and when that user is logged in he can shutdown the system from the GUI menu( KDE and GNOME) with default permissions.
    But if the user try to do "/sbin/shutdown -h now" from a command line, it says he has to be the root even if the permission is 777 for the shutdown command.

    Obviously this can be done using sudo ( as instronics mentioned) which is the best way and also it can be done if I set the setuid bit on the command. which is not at all a good way to do that.

    What I am trying to figure out is how its letting the user ( under default condition) to shutdown from GUI and not from command line.

    Thanx folks

Posting Permissions

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