[Linux-Anyway] Who's booting my machine and why won't suid work?

  • From: horrorvacui@xxxxxxx
  • To: Linux-Anyway@xxxxxxxxxxxxx <Linux-Anyway@xxxxxxxxxxxxx>
  • Date: Mon, 17 Mar 2003 21:39:38 +0100

Hey

In a start script I've written, I have a construct like this:

IPTABLES=
if [ -z "$IPTABLES" ]
then
        IPTABLES=`which iptables`
fi

- the idea being that you don't have to define the variable if you don't
want to, and if it's not defined, the script will use which to define it.
That works fine, only not where it should - as start script. When I run it
as root, it works, when it's run as a start script, it doesn't. The error
I get is "which: command not found" So who's booting my machine?

Init, yes, but what UID does it use? Until now I vaguely imagined it was
root, but since "which" is in root's path, obviously not. I've tried
looking this up, but nada. ps says init is root, as does top. If init runs
bash as root, it should have root's $PATH as well, right? Or am I missing
something here? Some kind of reduced boot-up $PATH containing only /bin
and /sbin, perhaps?

And there's another thing as well. To connect to my ADSL ISP, I have to
use VPN connection via PPTP protocole, authenticated using MS-CHAP - the
pptp client does this for me. I've tried several times in the past to make
it suid root so others can connect as well, and can't figure out why it
doesn't work. Here the permissions of pptp:

-rwS--s--x  1 root root  129642 Dec 25  2001 pptp

I've tried and tried, but can't turn the x-permission for everybody into
an s. I've tried so far:
chmod a+s...
chmod o+s...
chmod 6711...

Well, in a way it does half-work. Previously, pptp wouldn't hear of being
started as non-root user, now it comes up, says it can't open device
/dev/ttya0 and dies:

21:13:51 horrovac@www:~ >> (unknown)[4455]:
log[pptp_dispatch_ctrl_packet:pptp_ctrl.c:531]: Client connection
established.
(unknown)[4455]: log[pptp_dispatch_ctrl_packet:pptp_ctrl.c:637]: Outgoing
call established.
Failed to open /dev/ttya0: Permission denied
[1]+  Exit 7                  /sbin/pptp alcatel


Yet contrary to what the permissions of pptp (and the fact that it can't
open a device) would let you think, it DOES run as root - here's what ps
lists when I run it non-root:
root      4455  0.0  0.1  1420  700 pts/2    S    21:13   0:00 pptp: call
manager for 10.0.0.138
root      4456  0.0  0.1  1424  668 pts/2    S    21:13   0:00 pptp:
GRE-to-PPP gateway on /dev/ptya0 

And here's the same, when started by root:
root      4500  0.1  0.1  1420  700 pts/1    S    21:16   0:00 pptp: call
manager for 10.0.0.138
root      4501  0.0  0.1  1420  656 pts/1    S    21:16   0:00 pptp:
GRE-to-PPP gateway on /dev/ptya0

As root, the connection succeeds:
21:16:45 root@www:/sbin  # (unknown)[4500]:
log[pptp_dispatch_ctrl_packet:pptp_ctrl.c:531]: Client connection
established.
(unknown)[4500]: log[pptp_dispatch_ctrl_packet:pptp_ctrl.c:637]: Outgoing
call established.
Using interface ppp0
Connect: ppp0 <--> /dev/ttya0
local  IP address 62.47.53.184
remote IP address 172.19.89.138

Any ideas as to why this is happening, and more importantly, WHAT the hell
is happening?

Cheers

-- 
Horror Vacui

Registered Linux user #257714

Go get yourself... counted: http://counter.li.org/
- and keep following the GNU.
To unsubcribe send e-mail with the word unsubscribe in the body to:   
Linux-Anyway-Request@xxxxxxxxxxxxx?body=unsubscribe

Other related posts:

  • » [Linux-Anyway] Who's booting my machine and why won't suid work?