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

Re: kbdrate as ordinary user



On Fri, Nov 29, 2002 at 12:00:00AM +0000, Ward Vandewege wrote:
> Hi all,
> 
> ** Debian testing/unstable **
> 
> I'm having some trouble here with kbdrate. The problem is that on resume from
> an apmd suspend, my laptop defaults back to a keyboard repeat rate of 10, and
> that is _really_ slow. Manually executing kbdrate -r30 as root solves that
> problem. But of course I don't work as root, and it obviously should be
> automatable.
> 
> I've tried putting a little script in /etc/apm/event.d called 'kbdrate', that
> looks like this:
> 
> #!/bin/bash
> # /etc/apm/event.d/kbdrate
> 
> if [ "$1" = "resume" ] ; then
>         /sbin/kbdrate -r30 -d250
> fi
> 
> But that doesn't do it.
> 
> Also, when executing /sbin/kbdrate as a user, one gets 'Cannot open
> /dev/port: permission denied'. I've tried setuid & setguid'ing /dev/port,
> doesn't help.
> 
> I've even tried setuid & setguid'ing my little kbdrate script in
> /etc/apm/event.d, but that doesn't help either.
> 
> Any suggestions?
> 
> Thanks in advance,
> Ward.

Setu/giding a shell script doesn't work. You have to setuid the shell
which is running the script. And you don't want a so-called "root
shell" anywhere on your system!

1) man sudo - for the "proper" way to do it

2)
$ cat > kfast.c
#include <stdlib.h>
int main(void){return(system("/sbin/kbdrate -r30 -d250"));}
^D
$ gcc kfast.c -o kfast
$ su root
# chown root kfast
# chmod u+s kfast

3) make /sbin/kbdrate setuid root.

Pigeon



Reply to: