Gentoo Archives: gentoo-user

From: Wade Brown <wanderer.wcb@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] non-sudo way for user to run shutdown -h now? (or any equivalent)
Date: Wed, 20 Jul 2005 19:20:46
Message-Id: cee44eb3050720121665b84b60@mail.gmail.com
In Reply to: Re: [gentoo-user] non-sudo way for user to run shutdown -h now? (or any equivalent) by Mark Knecht
1 I thought linux wouldn't allow suid shell scripts to work as suid.
2 The reasoning is a shell script doesn't quite execute, it gets
3 interpeted by the command on the first line. Just as a test I made a
4 simple script modded root.root 4755 that consists of the /bin/bash
5 line, and cat /etc/shadow. Root can run just fine obviously, but
6 permissions don't exist for other users to do that.
7
8 What may work a little better is either chmod s+x `which shutdown`, or
9 writing a C wrapper and modding that s+x.
10
11 On 7/20/05, Mark Knecht <markknecht@×××××.com> wrote:
12 > On 7/20/05, Richard Fish <bigfish@××××××××××.org> wrote:
13 > > Mark Knecht wrote:
14 > >
15 > > >Hi,
16 > > > I'm trying to get my mythfrontend box to allow a user to shut the
17 > > >machine down without the use of a keyboard. We are only using remote
18 > > >controls. suso doesn't seem to be an option because it requires a
19 > > >password. (AFAICT)
20 > > >
21 > > > Is there some other way that I could make this work?
22 > > >
23 > > >
24 > > >
25 > >
26 > > 2 options:
27 > >
28 > > 1. Sudo can be setup to allow some commands to be run without a
29 > > password. I think this entry in /etc/sudoers should work:
30 > >
31 > > mythtv ALL = NOPASSWD: /sbin/shutdown
32 >
33 > Yes, I have this working. My problem with this solution was slightly
34 > deeper. To get MythTV to execute this command I have to put 'sudo
35 > shutdown -h now' in a setup screen within the setup portion of
36 > mythfrontend. In a general sense I don't know how to do that without a
37 > keyboard being attached to the machine. So far I haven't found where
38 > MythTV stores this information so that I could edit it from an ssh
39 > login.
40 >
41 > Granted I can attach a keyboard for a few minutes when the machine is
42 > here at my house, but I'm hesitant to use a solution that I cannot fix
43 > via ssh when the machine is remote at my folks house.
44 >
45 > >
46 > > I have not tested this, so if something goes wrong, you'll have to try
47 > > and figure out "man sudoers".
48 > >
49 > > 2. Create a setuid (chmod 4711 /sbin/shutdown_by_anyone.sh) shell script
50 > > that runs shutdown. Be sure to export the PATH, and unset LD_PRELOAD
51 > > and LD_LIBRARY_PATH variables at the very beginning of the script. Also
52 > > make sure the interpreter line is "/bin/bash --". This doesn't fix all
53 > > of the security holes with setuid shell scripts, just the most common
54 > > and easiest to fix...
55 >
56 > I don't know how this is much of a security issue for me, but then
57 > again I don't know much about security, and I suppose it could be if
58 > someone plugs a keyboard in and wants to cause some harm. Shame on
59 > them, but good of you to consider it.
60 >
61 > Thanks,
62 > Mark
63 >
64 > --
65 > gentoo-user@g.o mailing list
66 >
67 >
68
69 --
70 gentoo-user@g.o mailing list

Replies

Subject Author
Re: [gentoo-user] non-sudo way for user to run shutdown -h now? (or any equivalent) Richard Fish <bigfish@××××××××××.org>