LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 12-20-2007, 11:40 PM   #1
swamprat
Member
 
Registered: Sep 2005
Location: New Jersey, (Which Exit), USA
Distribution: Centos 5 Under VMware in WinXP CentOS 5.3 all under VMware
Posts: 418

Rep: Reputation: 33
User can shutdown system.


Hello,

I just defined a new user on the system. User has a UID of 502.

He is using KDE on Centos5.

This isn't a root user but when he goes to log out he gets a screen where he can do one of the following:

Turn Off Computer
End Current Session
Restart Computer
Cancel

The user is logging in at the master terminal, not remotely.

Because this user is just a general user and never as root, is there any way to not allow him to use any of the above options except Cancel and End Current Session? I never what such a user to turn off the machine or restart it.

Thanks.
 
Old 12-21-2007, 01:40 AM   #2
aus9
Guru
 
Registered: Oct 2003
Posts: 5,060

Rep: Reputation: Disabled
assuming you use KDE as well...click into kde control center/System Admin/Login Mgr/
click on admin ....enter root password and go to shutdown tab

allow shutdown...change from everyone to only root.

Observe the pathway to the reboot command....it may be /usr/bin or /bin or /sbin etc

click oK and exit.

If you use KDE go into Konqueror in root mode and change the permissions of that reboot to rwx for root and r-- for group and others
 
Old 12-21-2007, 01:41 AM   #3
jailbait
Guru
 
Registered: Feb 2003
Location: Blue Ridge Mountain
Distribution: Debian Wheezy, Debian Jessie
Posts: 7,575

Rep: Reputation: 184Reputation: 184
Quote:
Originally Posted by swamprat View Post
Hello,

I just defined a new user on the system. User has a UID of 502.

He is using KDE on Centos5.

This isn't a root user but when he goes to log out he gets a screen where he can do one of the following:

Turn Off Computer
End Current Session
Restart Computer
Cancel

The user is logging in at the master terminal, not remotely.

Because this user is just a general user and never as root, is there any way to not allow him to use any of the above options except Cancel and End Current Session? I never what such a user to turn off the machine or restart it.

Thanks.
Defining who can shutdown or restart the computer is done in a file called kdmrc. The problem is that different distributions put kdmrc in different places. Find kdmrc with:

find / -iname "*kdmrc*"

Then look through kdmrc for lines similar to:

AllowShutdown=All
AllowShutdown=none
AllowShutdown=username

Some of these lines will apply to root, some to remote users, and some to local users. Figure out which one applies to local users and set:

AllowShutdown=none


----------------------------
Steve Stites
 
Old 12-21-2007, 03:39 AM   #4
roy_lt_69
Member
 
Registered: Aug 2006
Location: Vancouver, BC, Canada
Distribution: Slackware, Bodhi, Mepis, AntiX, Mint
Posts: 172

Rep: Reputation: 21
You might want to change the execution flags for several Linux commands such as reboot, shutdown, halt, init, and telinit, so that non-root users/groups cannot open up a console and run these commands manually.
(Some are links to actual programs.)
Also check /etc/sudoers and don't forget suid/guid.
There may be other commands also (anyone?).

Not sure if you will have side-effects though.

Last edited by roy_lt_69; 12-21-2007 at 03:43 AM.
 
Old 12-21-2007, 08:37 AM   #5
bsdunix
Senior Member
 
Registered: May 2006
Distribution: Caldera, CTOS, Debian, FreeBSD, Mac OS X, Mandrake, Minix, OpenBSD, Slackware, SuSE
Posts: 1,757

Rep: Reputation: 79
Quote:
Originally Posted by swamprat View Post
The user is logging in at the master terminal, not remotely.

Because this user is just a general user and never as root, is there any way to not allow him to use any of the above options except Cancel and End Current Session? I never what such a user to turn off the machine or restart it.
Have you considered physical access to the power button and power cord on the master terminal? So no restart or shutdown on the menu, what will prevent the user from leaning over and either pushing the the power button or pulling the cord? Or is this not a concern?
 
Old 12-21-2007, 10:35 AM   #6
this213
Member
 
Registered: Dec 2001
Location: ./
Distribution: Fedora, CentOS, RHEL, Gentoo
Posts: 167

Rep: Reputation: 34
Quote:
Originally Posted by roy_lt_69
You might want to change the execution flags for several Linux commands such as reboot, shutdown, halt, init, and telinit, so that non-root users/groups cannot open up a console and run these commands manually.
X is running as root and so has access to these commands. There's no need to change file permissions on the executables and doing so will have no effect.

The options are to either change those settings specific to KDE (or Gnome) or to have X start in user mode (boot to runlevel 3, then have "startx" in your user login scripts).
 
Old 12-22-2007, 09:19 PM   #7
roy_lt_69
Member
 
Registered: Aug 2006
Location: Vancouver, BC, Canada
Distribution: Slackware, Bodhi, Mepis, AntiX, Mint
Posts: 172

Rep: Reputation: 21
I believe in the original post the poster did not want a non-root user to be able to reboot/shutdown the system.
Disabling the options in KDE/Gnome (or whatever GUI) will only stop the user from selecting those options from the menu, it will not stop them from opening a terminal window and manually typing the commands.
And that is what I was trying to address.
Of course that will not stop someone from physically hitting the on/off/reset switch or even pulling the plug.
 
Old 12-23-2007, 05:40 AM   #8
aus9
Guru
 
Registered: Oct 2003
Posts: 5,060

Rep: Reputation: Disabled
they are all good replies, lets wait for the OP to reply?
 
Old 12-24-2007, 01:50 PM   #9
bsdunix
Senior Member
 
Registered: May 2006
Distribution: Caldera, CTOS, Debian, FreeBSD, Mac OS X, Mandrake, Minix, OpenBSD, Slackware, SuSE
Posts: 1,757

Rep: Reputation: 79
Quote:
Originally Posted by aus9 View Post
they are all good replies, lets wait for the OP to reply?
I wouldn't hold my breath.
 
  


Reply

Tags
centos, kde, kde configuration, reboot, shutdown


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
C program to see user log on in system and print user with real user name also naveen245 Programming 2 12-21-2005 01:53 AM
Can't "shutdown -a -r now" as a normal user, though shutdown.allow exists mnemonic Linux - Software 5 08-15-2005 07:49 PM
Using shutdown as user bluesmanu Linux - General 1 05-25-2005 09:40 AM
System Halting while shutdown system. LiloAma Linux - Software 15 01-02-2005 09:30 PM
shutdown user alaios Linux - General 14 07-09-2004 09:49 AM


All times are GMT -5. The time now is 12:29 PM.

Main Menu
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