LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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 03-19-2009, 01:31 PM   #1
mitchellray
Member
 
Registered: Feb 2009
Posts: 44

Rep: Reputation: 16
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.

ls -l shutdown2
-rwxr-xr-x 1 root root 16864 2008-04-02 19:40 shutdown2

So why is the output

$ shutdown2
-bash: shutdown2: command not found

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
 
Old 03-19-2009, 04:58 PM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,636

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by mitchellray View Post
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.

ls -l shutdown2
-rwxr-xr-x 1 root root 16864 2008-04-02 19:40 shutdown2

So why is the output

$ shutdown2
-bash: shutdown2: command not found

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.
 
Old 03-19-2009, 05:02 PM   #3
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Blog Entries: 5

Rep: Reputation: Disabled
Quote:
Originally Posted by mitchellray
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.
 
Old 03-20-2009, 02:34 PM   #4
mitchellray
Member
 
Registered: Feb 2009
Posts: 44

Original Poster
Rep: Reputation: 16
FC5 and Fedora10 users can shutdown - How?

Thank you TBOne and anomie.

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
 
Old 03-20-2009, 09:31 PM   #5
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,636

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by mitchellray View Post
Thank you TBOne and anomie.

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.
 
  


Reply



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
My Linux box does not shutdown i do when i do /sbin/shutdown -h now yawe_frek Linux - Hardware 6 09-14-2007 07:48 AM
Shutdown Problem /usr: device is busy epicdd Red Hat 8 10-10-2005 01:59 PM
Can't "shutdown -a -r now" as a normal user, though shutdown.allow exists mnemonic Linux - Software 5 08-15-2005 06:49 PM
/sbin/shutdown german Linux - Software 2 09-03-2004 01:30 PM
/sbin/shutdown BaerRS Linux - General 3 07-17-2003 02:09 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop

All times are GMT -5. The time now is 02:06 PM.

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
Open Source Consulting | Domain Registration