User shutdown - 'cp -i -p shutdown /usr/sbin/shutdown2 - why does this not work, can?
Linux - DesktopThis forum is for the discussion of all Linux Software used in a desktop context.
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.
User shutdown - 'cp -i -p shutdown /usr/sbin/shutdown2 - why does this not work, can?
Hello,
Why can not 'shutdown' script file be copied to path of ordinary user and then called?
After I copied to new file /usr/sbin/shutdown2 (which I thought was in the ordinary users' path), I still could not shutdown. Why can't user call for that executable file?
Interestingly, as root, I was able to call 'shutdown2 -hP now' and affect a power off.
It seems that users and root have the same login shell, yet the command is not found.
I have seen that others have solved using sudoer, however, other os seem to have it already available for users to call 'shutdown' without invoking 'sudo'.
M
Hello,
Why can not 'shutdown' script file be copied to path of ordinary user and then called?
After I copied to new file /usr/sbin/shutdown2 (which I thought was in the ordinary users' path), I still could not shutdown. Why can't user call for that executable file?
Interestingly, as root, I was able to call 'shutdown2 -hP now' and affect a power off.
It seems that users and root have the same login shell, yet the command is not found.
I have seen that others have solved using sudoer, however, other os seem to have it already available for users to call 'shutdown' without invoking 'sudo'.
M
Don't know what other OS you are referring to, but every Linux/unix system I've worked with, needs root privileges to shut the system down. It's a security feature...shutdown, along with alot of other programs, need escalated privs to run. Putting a 'regular' user ID in sudoers, then calling it with "sudo <command name>", let's you stay in a 'regular' account (so you can't damage things accidently), and only escalate when needed.
What shell root and users run don't make a difference..it's the privilege level they run it AS that makes the difference.
After I copied to new file /usr/sbin/shutdown2 (which I thought was in the ordinary users' path), I still could not shutdown. Why can't user call for that executable file?
You've got two different issues. The first is privileges, as already mentioned. The second is PATH.
Check the results of $ echo $PATH as root and as a regular user, and compare.
I have previously loaded FC5, Fedora10 and Ubuntu and all three allowed me to shutdown and poweroff without additional permissions granted by root.
This is a desktop computer AMD K7.
I am yet to fully understand the permission issue since I thought that the users were able to read and execute the command as above.
I also tried putting 'shutdown3' in '/usr/bin' just for trial and error. My error.
M
I have previously loaded FC5, Fedora10 and Ubuntu and all three allowed me to shutdown and poweroff without additional permissions granted by root.
This is a desktop computer AMD K7.
I am yet to fully understand the permission issue since I thought that the users were able to read and execute the command as above.
I also tried putting 'shutdown3' in '/usr/bin' just for trial and error. My error.
M
If you set the workstations up to allow shutdown from the console, and allow any user to run it, it WILL shut down as a 'regular' user. Ubuntu is geared towards non-power users, so shutdown will work fine.
From the command line, though, things are different.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.