LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices



Reply
 
Search this Thread
Old 12-31-2012, 08:38 PM   #1
baronobeefdip
Senior Member
 
Registered: Jul 2009
Distribution: Debian Squeeze
Posts: 1,203

Rep: Reputation: 32
how do i prevent regular user from shutting down the system


I have a debian box running as my DNS and Web server and I also have my brother use it for his purposes but every time he leaves the computer he shuts it down, He uses the computer like 5 to 7 times a day and shuts it down between uses, (is this safe for the power supply). I want to know how to prevent him from turning the system off as a regular user.
 
Old 12-31-2012, 10:19 PM   #2
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,758

Rep: Reputation: 644Reputation: 644Reputation: 644Reputation: 644Reputation: 644Reputation: 644
The simplest way is user education ... have you tried asking him to log off instead of shutdown? If you're running Gnome 3 he won't even see the shutdown option unless he enables the alternate status menu.
 
Old 01-01-2013, 12:35 AM   #3
baronobeefdip
Senior Member
 
Registered: Jul 2009
Distribution: Debian Squeeze
Posts: 1,203

Original Poster
Rep: Reputation: 32
He won't do it, he claims that it uses a lot of power but now I want to know if turning it on and off in the way that he does will ruin the power supply. User education in this situation doesn't seem very effective given that I am reasoning with a 13 year old
 
Old 01-01-2013, 12:50 AM   #4
Timothy Miller
Member
 
Registered: Feb 2003
Location: Arizona, USA
Distribution: Debian Jessie, OpenSuse 13.1, Chakra.
Posts: 727

Rep: Reputation: 114Reputation: 114
I would think that if you were to chmod o-x /sbin/shutdown (maybe go-x depending on how your distro set up rights to it), depending on how it's being shutdown (not all DE's use this command directly) that should suffice.

Last edited by Timothy Miller; 01-01-2013 at 12:53 AM.
 
Old 01-01-2013, 02:02 AM   #5
dinkus223
LQ Newbie
 
Registered: Aug 2010
Location: Memphis, 10
Distribution: Rotates on weekly or monthly basis
Posts: 22

Rep: Reputation: 3
First
Code:
sudo visudo
Then add alias for shutdown commands in a convenient place for you. I did mine under the supplied commented commands.
Code:
Cmnd_Alias SHUTDOWN = /sbin/halt, /sbin/shutdown, /sbin/poweroff, /sbin/reboot, /sbin/init
Then add the username and permissions you want to grant/allow.
So he can't run the shutdown commands defined, even with sudo use:
Code:
username    localhost=!SHUTDOWN
You might want to add pm-hibernate, pm-powersave, pm-suspend and pm-suspend-hybrid if you have them just in case. I am not that familiar with Debian, they are provided by the pm-utils-1.4.1-8.fc15.i686.rpm in Fedora 15.

Learn about the /etc/sudoers file to control what he can run or not.
The /etc/pam.d/su file has permissions to control who can switch to root. It might be helpful if he is knowledgeable on his commands.

If he complain, remind him of his refusal to comply with your request to not shutdown the computer. Be respectful and give him an out so he won't feel some type of way about what you had to do. After all you got business going on.
 
Old 01-01-2013, 03:19 PM   #6
baronobeefdip
Senior Member
 
Registered: Jul 2009
Distribution: Debian Squeeze
Posts: 1,203

Original Poster
Rep: Reputation: 32
Quote:
Originally Posted by dinkus223 View Post
First
Code:
sudo visudo
Then add alias for shutdown commands in a convenient place for you. I did mine under the supplied commented commands.
Code:
Cmnd_Alias SHUTDOWN = /sbin/halt, /sbin/shutdown, /sbin/poweroff, /sbin/reboot, /sbin/init
Then add the username and permissions you want to grant/allow.
So he can't run the shutdown commands defined, even with sudo use:
Code:
username    localhost=!SHUTDOWN
You might want to add pm-hibernate, pm-powersave, pm-suspend and pm-suspend-hybrid if you have them just in case. I am not that familiar with Debian, they are provided by the pm-utils-1.4.1-8.fc15.i686.rpm in Fedora 15.

Learn about the /etc/sudoers file to control what he can run or not.
The /etc/pam.d/su file has permissions to control who can switch to root. It might be helpful if he is knowledgeable on his commands.

If he complain, remind him of his refusal to comply with your request to not shutdown the computer. Be respectful and give him an out so he won't feel some type of way about what you had to do. After all you got business going on.
Will this also prevent him from sing the menu at the top in the gnome desktop environment to shut it down (or at least be prompted for the password). At this point the only thing he can do is hard shut it down with the button in the front but you can always remove the pin inside of the case
 
Old 01-02-2013, 03:24 AM   #7
dinkus223
LQ Newbie
 
Registered: Aug 2010
Location: Memphis, 10
Distribution: Rotates on weekly or monthly basis
Posts: 22

Rep: Reputation: 3
Works on command line, not in Gnome2.32.0 or Xfce4 GUI on Fedora 15 machine. I don't have KDE installed. Will try to find a solution, might need it in the future.
 
Old 01-02-2013, 10:35 AM   #8
jefro
Guru
 
Registered: Mar 2008
Posts: 12,093

Rep: Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521Reputation: 1521
There is nothing wrong with shutting down a computer. You don't leave your car, tv, or nuclear submarine running all day do you? Well, maybe the nuke sub.

Shut it down when not in use and save some energy.
 
Old 01-02-2013, 11:08 AM   #9
Lennie
Member
 
Registered: Aug 2012
Location: Sweden
Distribution: LFS, built with pacman
Posts: 302

Rep: Reputation: 61
Some distros use consolekit to shutdown. You can add a rule about it by creating the file /etc/polkit-1/50-local.d/disable-shutdown.pkla:

Code:
[Disable shutdown]
Identity=unix-user:username
Action=org.freedesktop.consolekit.system.stop;org.freedesktop.consolekit.system.restart
ResultAny=no
ResultInactive=no
ResultActive=no
'man pklocalauthority' will tell you more about it.
 
Old 01-02-2013, 02:21 PM   #10
Valosar
Member
 
Registered: Aug 2012
Location: Kentucky, USA
Distribution: Mint 14 Mate, Knoppix , #!
Posts: 44

Rep: Reputation: 1
Jefro I think the point is he doesn't want it shutdown because it is his webserver/dns which is only useful when it is on I find this interesting as I've got two small children 4/5 who use my computer for playing educational games. I've given them easy to remember passwords and user names so they can get practice in at a young age with this sort of thing. They like to shut the computer off when they're done as well, I'm also running on a Debian based distro (mint 14 in this case) Let us know what solution you end up using and how effective it is. If he is really stuborn he can just turn off the power supply or the power source (unplug it for example) My children figured that out recently and enjoy the clicky sound it makes when you turn off the power supply directly <sigh>
 
Old 01-03-2013, 03:51 AM   #11
dinkus223
LQ Newbie
 
Registered: Aug 2010
Location: Memphis, 10
Distribution: Rotates on weekly or monthly basis
Posts: 22

Rep: Reputation: 3
Thanks Lennie, that' where I was headed. Glad to know I was on the right track with my research. ConsoleKit is something I never used until learning that the shutdown button is routed through dbus.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
difference between regular user and system user (and groups) kushalkoolwal Linux - General 1 09-28-2010 05:25 PM
Prevent a non-root user from shutting down, rebooting or suspend the system Peter Cattaneo Linux - Security 2 03-03-2010 01:19 PM
How Do I Prevent Display From Shutting Off? MadAtUbuntu Linux - Server 2 12-27-2009 03:36 PM
Prevent a non-root user from shutting down, rebooting or suspend the system m2azer Linux - Security 7 10-30-2007 09:15 AM
regular user program causing system freeze win32sux Slackware 2 02-07-2005 08:32 PM


All times are GMT -5. The time now is 08:49 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration