Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Distribution: Centos 7 , Linux Mint 18.1 Under VMware in Windows 10
Posts: 554
Rep:
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.
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:
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?).
Distribution: BeOS, BSD, Caldera, CTOS, Debian, LFS, Mac, Mandrake, Red Hat, Slackware, Solaris, SuSE
Posts: 1,761
Rep:
Quote:
Originally Posted by swamprat
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?
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).
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.