Networking Forums

Networking Forums > Computer Networking > Linux Networking > Need a reliable modem hangup

Reply
Thread Tools Display Modes

Need a reliable modem hangup

 
 
Fishbaugher
Guest
Posts: n/a

 
      02-05-2004, 04:45 PM
I need some method for reliably hanging up the modem from a user space
script which has just completed an ftp transfer. I have tried the
following:

killall getty

This normally works from the command line with a su logon. But I get
a 'permission denied' error when trying this from user space.

kill -HUP `cat /var/run/ppp0.pid`

This will shut down the pppd process again from an su logon, but gives
the same permission denied from user space.

I have also tried placing these commands in a shell script with root
ownership and chmod 6777 permission. This also gives the permission
denied message when executed from a user logon.... Anyone have a
suggestion what to try next?
 
Reply With Quote
 
 
 
 
jack
Guest
Posts: n/a

 
      02-05-2004, 05:20 PM
Fishbaugher wrote:
> I need some method for reliably hanging up the modem from a user space
> script which has just completed an ftp transfer. I have tried the
> following:
>
> killall getty
>
> This normally works from the command line with a su logon. But I get
> a 'permission denied' error when trying this from user space.
>
> kill -HUP `cat /var/run/ppp0.pid`
>
> This will shut down the pppd process again from an su logon, but gives
> the same permission denied from user space.


You needn't kill pppd to hangup Your modem. - Anyways, as You already
found out, it's a matter of permissions.


> I have also tried placing these commands in a shell script with root
> ownership and chmod 6777 permission. This also gives the permission
> denied message when executed from a user logon.... Anyone have a
> suggestion what to try next?


The suid-bit will be ignored on scripts (for very obvious security
reasons). What You can do, though, is to "sudo" to hangup Your modem.
Needs proper configuration, but circumvents those restrictions based
on a user and command definition.

I was warned about using "sudo" some time ago, but unfortunally, I
don't remember the context. So I still use it for the rare occasions
in that I need to do such thing.


Cheers, Jack.

--
----------------------------------------------------------------------
My personal reading of the string "MicroSoft" expands to "NanoWeak"...

 
Reply With Quote
 
Fishbaugher
Guest
Posts: n/a

 
      02-06-2004, 01:23 PM
> The suid-bit will be ignored on scripts (for very obvious security
> reasons). What You can do, though, is to "sudo" to hangup Your modem.
> Needs proper configuration, but circumvents those restrictions based
> on a user and command definition.
>

I looked into the sudo and /etc/sudoers man pages and it appears
possible to do this using the NOPASSWRD flag in the setup file. Thus
an sudo command presumably would not prompt for a password and thus
you could execute something like:

sudo killall getty

from a script. I am wondering about your first comment about the
suid-bit not working on scripts. How about if I write a simple
compiled C program which does nothing but do a system() call with the
killall command. Perhaps I could set the suid bit on that compiled
program and circumvent the need for the whole rather messy sudoes
setup? The machine this is running on is an embedded system with an
older kernel based on a rather ancient RH4.0 disto which did not even
include sudo...

Thanks for the help

MJF
 
Reply With Quote
 
Johan Lindquist
Guest
Posts: n/a

 
      02-06-2004, 01:40 PM
So anyway, it was like, 15:23 CET Feb 06 2004, you know? Oh, and, yeah,
Fishbaugher was all like, "Dude,

> How about if I write a simple compiled C program which does nothing
> but do a system() call with the killall command. Perhaps I could set
> the suid bit on that compiled program and circumvent the need for
> the whole rather messy sudoes setup?


Implementing sudo is probably several orders of magnitude less risky
than setting suid bits on executables. Fwiw, I don't find sudoers all
that messy, but I suppose ymmv there. It's a handy tool for sure, in
any event.

--
Time flies like an arrow, fruit flies like a banana. Perth ---> *
15:39:14 up 12 days, 23:15, 1 user, load average: 2.44, 2.24, 2.22
$ cat /dev/bollocks Registered Linux user #261729
benchmark back-end e-business
 
Reply With Quote
 
jack
Guest
Posts: n/a

 
      02-06-2004, 01:43 PM
Fishbaugher wrote:
> I looked into the sudo and /etc/sudoers man pages and it appears
> possible to do this using the NOPASSWRD flag in the setup file. Thus
> an sudo command presumably would not prompt for a password and thus
> you could execute something like:
>
> sudo killall getty
>
> from a script.


Exactly.


> I am wondering about your first comment about the
> suid-bit not working on scripts. How about if I write a simple
> compiled C program which does nothing but do a system() call with the
> killall command. Perhaps I could set the suid bit on that compiled
> program and circumvent the need for the whole rather messy sudoes
> setup? The machine this is running on is an embedded system with an
> older kernel based on a rather ancient RH4.0 disto which did not even
> include sudo...


That _should_ work... - I had had a situation a year or so ago when,
under certain circumstances, it didn't. I did _loads_ of examinations
then but never really found the reason for that behaviour.


Cheers, Jack.

--
----------------------------------------------------------------------
My personal reading of the string "MicroSoft" expands to "NanoWeak"...

 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
network hangup tom yandell Windows Networking 3 05-02-2006 10:53 PM
auto hangup for DUN? midol Windows Networking 1 01-29-2006 07:58 PM
Hangup modem from another phone J Smith Linux Networking 2 03-05-2005 04:00 AM
XP disk on ME System: Hangup during setup update Ken K. in Atlanta Windows Networking 1 05-15-2004 02:06 PM
hangup isdn Manuel Aldana Linux Networking 1 04-02-2004 04:02 PM



1 2 3 4 5 6 7 8 9 10 11