gnokii-users
[Top][All Lists]
Advanced

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

Re: Gnokii-smsd-mysql question


From: Paul Darius
Subject: Re: Gnokii-smsd-mysql question
Date: Sun, 28 Mar 2010 09:22:58 +0700

This is the permission and ownership of /dev/ttyUSB0 when it reboot.
$ ls -l /dev/ttyUSB0
crw-rw---- 1 root uucp 188, 0 Mar 27 21:15 /dev/ttyUSB0

and this is what gnokii-smsd..
--- start ---
$ cat /etc/rc.d/init.d/gnokii-smsd
#!/bin/sh
#
# gnokii-smsd  Starts and stops the Gnokii SMS daemon
#
# chkconfig:   - 95 05
#
# processname: gnokii-smsd
# description: Gnokii SMS daemon receives and sends SMS messages.
# config:      /etc/gnokiirc
# config:      /etc/sysconfig/gnokii-smsd

exec=/usr/bin/gnokii-smsd
prog=$(basename $exec)

# Make sure relevant files exist
[ -x $exec -a -e /etc/sysconfig/gnokii-smsd ] || exit 0

# Source SMSD configuration.
. /etc/sysconfig/gnokii-smsd

[ -n "$SMSD_OPTS" ] || exit 0
[ -z "$SMSD_LOG"  ] || SMSD_OPTS="$SMSD_OPTS --logfile \"$SMSD_LOG\""

# Source function library.
. /etc/rc.d/init.d/functions

lockfile=/var/lock/subsys/$prog

start() {
   # Ensure that we have a writable log file.
   echo -n $"Starting Gnokii SMS daemon ($prog): "
   if [ -n "$SMSD_LOG" ]; then
       [ -e "$SMSD_LOG" ] || > "$SMSD_LOG"
       chmod 0640 "$SMSD_LOG"
       chown gnokii:gnokii "$SMSD_LOG"
   fi
   echo -n $"Starting Gnokii SMS daemon ($prog): "
   daemon --user gnokii $exec $SMSD_OPTS \&
   retval=$?
   echo
   [ $retval -eq 0 ] && touch $lockfile
   return $retval
}

stop() {
   echo -n $"Stopping Gnokii SMS daemon ($prog): "
   killproc $prog
   retval=$?
   echo
   [ $retval -eq 0 ] && rm -f $lockfile
   return $retval
}

restart() {
   stop
   start
}

# See how we were called.
case "$1" in
 start|stop|restart)
   $1
   ;;
 reload|force-reload)
   restart
   ;;
 condrestart|try-restart)
   [ ! -f $lockfile ] || restart
   ;;
 status)
   status $prog
   ;;
 *)
echo $"Usage: $0 {start|stop|status|restart|try-restart|reload|force-reload}"
   exit 2
esac
--- end ---

This is /etc/sysconfig/gnokii-smsd
--- start ---
$ cat gnokii-smsd
# -*- sh -*-
# All options to Gnokii SMS daemon (gnokii-smsd), *except* log file.
#
# Note that due to security reasons, it is not advisable to set the
# database password here (if you can avoid doing so) because it may be
# visible in eg. ps(1) output.
#
# Example:
#  SMSD_OPTS="--user smsd --db smsd --host 127.0.0.1 --module pq"
#

SMSD_OPTS="--user smsd --password gnokii-smsd --db smsd --host 127.0.0.1 --module mysql"

#
# Log file location. If you adjust this, see also /etc/logrotate.d/gnokii-smsd
#

SMSD_LOG="/var/log/gnokii-smsd"
---end---

and this is the ps output when it running :
# ps waxu|grep gnokii-smsd
gnokii 28386 1.0 1.2 32280 2748 ? Sl 09:17 0:00 /usr/bin/gnokii-smsd --user xxxx --password xxxxxxxxxxx --db xxxx --host xxxxxxxxx --module mysql --logfile /var/log/gnokii-smsd

other.. the /var/log/gnokii-smsd always empty.

Paul
----- Original Message ----- From: "Jan Derfinak" <address@hidden>
To: "Discussion forum for gnokii users." <address@hidden>
Sent: Sunday, March 28, 2010 4:14 AM
Subject: Re: Gnokii-smsd-mysql question


On Sat, 27 Mar 2010, Paul Darius wrote:

/dev/ttyUSB0 permission is 660

seems that /etc/rc.d/init.d/gnokii-smsd will run when /dev/ttyUSB0 permission
become 666.
but this device permission always become 660 when the box reboot.

what should we do ?

I assume that script /etc/rc.d/init.d/gnokii-smsd drops the root privilege.
You must find what it realy does and under which user and group it starts
smsd. Then you must look on owner and group of /dev/ttyUSB0.
Then you must find a way how to unify owner or group of smsd and device or
way how to permanently change ownership or mode of device (for example in udev
rules). Consult documentation for your distribution.

jan

----- Original Message ----- From: "Jan Derfinak" <address@hidden>
To: "Discussion forum for gnokii users." <address@hidden>
Sent: Thursday, March 25, 2010 9:09 PM
Subject: Re: Gnokii-smsd-mysql question


> On Wed, 24 Mar 2010, Paul Darius wrote:
>
> Hello.
>
> > Initializing AT capable mobile phone ...
> > Serial device: opening device /dev/ttyUSB0
> > Gnokii serial_open: open: Permission denied
> > Couldn't open ATBUS device: Permission denied
> > AT bus initialization failed (1)
> > Initialization failed (1)
> > Serial device: closing device
> > Telephone interface init failed: Command failed.
> > Quitting.
> > Cannot unlock device.
> > GSM/FBUS init failed! (Unknown model?). Quitting.
> > Command failed.
> >
> > The gnokii --identify work fine as it can recognize the imei and > > other
> > info
> > BUT /etc/rc.d/init.d/gnokii-smsd can not open the ports
>
> I don't know what /etc/rc.d/init.d/gnokii-smsd is doing. Try to run > smsd by
> hand under the same user as you run gnokii --identify.
> What permission you have on /dev/ttyUSB0?
> Do you have selinux or other security magic enabled?
>
>
> jan
>
> -- >
>
> _______________________________________________
> gnokii-users mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/gnokii-users



_______________________________________________
gnokii-users mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/gnokii-users


--


_______________________________________________
gnokii-users mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/gnokii-users





reply via email to

[Prev in Thread] Current Thread [Next in Thread]