[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: wvdial | perl_error | cupsd | xchat



On Tue, 2003-04-22 at 11:41, Sebastian 'Frank©' Wieseler wrote:
> Hi guys,
> I have several questions - please help me.
> 
> Hallo, nice mailing-list :-)
> How are you, today? Can you help me a little bit? TIA!
> 
> First:
> Root can start wvdial but all other users get the error:
> $ wvdial
> --> WvDial: Internet dialer version 1.53
> --> Cannot open /dev/ttyS0: Permission denied
> --> Cannot open /dev/ttyS0: Permission denied
> --> Cannot open /dev/ttyS0: Permission denied
> 
> But all this users belongs to the group tty.
> Any idea?

when running wvdial, it starts pppd for you after authentication.
when pppd starts it takes control of (in your case /dev/ttyS0) the modem
device. in other words it chmods it to 640 (it is usually set to 660)
then everything is wonderful until you try to kill wvdial or pppd at
which point wvdial will catch the kill signal and then kill pppd for you
or you kill pppd manually. sometimes pppd does not change the
permissions back to 660. i dont know why, i think this is a bug in
wvdial, but i have no evidence to back this up (just a hunch).

so, short term solution, change the permissions for /dev/ttyS0.

long term solution #1, look at the wvdial code and fix it.

#2 hack a work around. heres what i have done:

make a c file and put in it:

#include <sys/types.h>
#include <sys/stat.h>
 
int main(){
        mode_t m = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP;
        int retval = chmod("/dev/modem", m);
        return retval;
}

compile with "gcc -o chmodem chmodem.c" or whatever you like.

this executable will change the permissions of /dev/modem to 660 for
you. the reason i had to make an executable for this is so i could use
the SUID bit. (you may change the /dev/modem to /dev/ttyS0 or create a
symbolic link from /dev/modem to /dev/ttyS0)

then i put this executable someplace nice like /usr/local/bin
and did a "chown root.tty /usr/local/bin/chmodem" and
"chmod 4750 /usr/local/bin/chmodem" so that when people from tty run
this, they will run it effectively as root. also /usr/local/bin should
already be in your PATH. check to make sure. (if not, add it)

then i made some wrapper scripts for bringing up wvdial

make a file called /usr/local/bin/wvdialon and put in it:

#!/bin/bash

chmodem
wvdial <your account info>

and another file called /usr/local/bin/wvdialoff and put in it:

#!/bin/bash

killall wvdial
chmodem

now do a "chown root.tty /usr/local/bin/wvdial*" and a 
"chmod 750 /usr/local/bin/wvdial*"

and use the scripts wvdialon and wvdialoff to de/activate your dialup.

enjoy,

-matt zagrabelny

ps. i would send separate emails for your different topics.



Reply to: