LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Special Permission for normal users (https://www.linuxquestions.org/questions/linux-general-1/special-permission-for-normal-users-4175416513/)

roni_atx 07-13-2012 08:37 AM

Special Permission for normal users
 
Hi Friends,

I am new in this forum. In my VM I have installed Redhat6 . It looks pretty good. I am facing a small problem. Hope with your help I can troubleshoot. I have created normal user as "test". Then I login to "test" user and was trying to execute shutdown/poweroff command. Normally it won't allow to user to do that. So I wanted to give special permission to "test" user where I could execute "shutdown/poweroff" command. kindly check the following syntax which I have executed in console mode.

chmod u+s /sbin/shutdown

I have executed above syntax from "root" account. Then i login to "test" account and was trying to execute "shutdown/poweroff" command. It said insufficient privilege after given special permission for all users. Could someone please suggest me how could I solve this problem?

Thanks a lot in advance !

Regards
Abhimanyu

MensaWater 07-13-2012 09:19 AM

It is generally NOT a good idea to change owner, group, permissions on system binaries. First off tools that check whether you've been hacked look for this, second many such tools are written so they won't work unless they have the expected settings and lastly any update to packages you do will likely change permissions back.

The best way to give non-root users access to root commands is with sudo. With sudo you setup a sudoers file to designate which users can run which commands. You can make it very broad (e.g. give all system administrators rights to do every command) or very specific (e.g. give a single user permission to execute a single command as root).

Be sure when giving users access to such commands that you understand exactly what you're giving them. For example you should NEVER give sudo access to vi,vim or many other editors because most of them allow access to the shell and the shell would be a root shell.

If you do a web search for "sudo tutorial" you'll find many. For example:
http://home.ubalt.edu/abento/linux/terminal/sudo.html

honeybadger 07-13-2012 02:07 PM

With RH I believe you are better off with using /etc/pam than changing the permissions (I really hope you know what the permissions are).
If you want the user to shutdown then editing the inittab is the best way. Any user can push ctrl+alt+del and shut down the system.
As far as shutdown is concerened it is a binary and so this binary has some libraries to make it run. If you want shutdown to be done by users then you would have chmod all the relevant libraries too. This is what I think - I may be wrong.

roni_atx 07-13-2012 02:50 PM

Hi Friends,

Many thanks for the valuable suggestion. Actually I am learning Linux. Just wanted to know that how I could execute the system command from normal user mode by using chmod command.

Regards
Abhimanyu


All times are GMT -5. The time now is 10:57 PM.