SMS Server Tools 3
This site is hosted by Kekekasvi.com
 Menu
Basic information:
Additional information:
Support:
Get SMS Server Tools 3:
Additional Options

 Sponsored links

 Search
Custom Search

 Visitor locations
 
 SMS Server Tools 3 Community
Welcome, Guest. Please login or register. Sat Nov 25, 2017 11:33
SMSTools3 Community » Sample scripts / setups Bottom

smsfile permission denied

Login and Post Reply

Page:  1

Author Post
Member
Registered:
May 2016
Location: Lusaka, Zambia
I want to intergrate sms alerts on the nagios monitoring tool installed on centOS 6.6. I have install smstools and when i try to send a test message, am getting an error "Access denied. Check the file and directory permissions".
[root@nagiostest bin]# cd /var/spool/sms/outgoing/
[root@nagiostest outgoing]# ll
total 8
-rw-------. 1 root root 27 May 19 15:31 send_a9eVLo
-rw-------. 1 root root 34 May 20 10:50 send_GuKfeB


but when i change the permissions for the sms files to:
[root@nagiostest outgoing]# chmod 777 send_GuKfeB

-rwxrwxrwx. 1 root root 34 May 20 10:50 send_GuKfeB

the messages are being sent.

*******here are the smsd.log files:**************

2016-05-20 10:50:18,7, GSM1: Command is sent, waiting for the answer
2016-05-20 10:50:18,7, GSM1: <- 356222003002086 OK
2016-05-20 10:50:18,5, GSM1: CGSN: 356222003002086
2016-05-20 10:50:18,5, GSM1: IMSI: 645030130764150
2016-05-20 10:50:18,5, GSM1: Waiting for messages to send...
2016-05-20 10:50:23,3, smsd: Cannot handle /var/spool/sms/outgoing/send_GuKfeB: Access denied. Check the file and directory permissions.
2016-05-20 11:19:23,5, smsd: Moved file /var/spool/sms/outgoing/send_a9eVLo to /var/spool/sms/checked
2016-05-20 11:19:24,6, GSM1: I have to send 1 short message for /var/spool/sms/checked/send_a9eVLo
2016-05-20 11:19:24,6, GSM1: Sending SMS from to 097789xxxxxx
2016-05-20 11:19:24,6, GSM1: Checking if modem is ready
2016-05-20 11:19:24,7, GSM1: -> AT
2016-05-20 11:19:24,7, GSM1: Command is sent, waiting for the answer
2016-05-20 11:19:25,7, GSM1: <- OK
2016-05-20 11:19:25,6, GSM1: Pre-initializing modem
2016-05-20 11:19:25,7, GSM1: -> ATE0+CMEE=1;+CREG=2
2016-05-20 11:19:25,7, GSM1: Command is sent, waiting for the answer
2016-05-20 11:19:25,7, GSM1: <- OK +CREG: 1,"2714","F822"
2016-05-20 11:19:25,7, GSM1: -> AT+CSQ
2016-05-20 11:19:25,7, GSM1: Command is sent, waiting for the answer
2016-05-20 11:19:26,7, GSM1: <- +CSQ: 17,0 OK
2016-05-20 11:19:26,6, GSM1: Signal Strength Indicator: (17,0) -79 dBm (Good), Bit Error Rate: less than 0.2 %
2016-05-20 11:19:26,6, GSM1: Checking if Modem is registered to the network
2016-05-20 11:19:26,7, GSM1: -> AT+CREG?
2016-05-20 11:19:26,7, GSM1: Command is sent, waiting for the answer
2016-05-20 11:19:26,7, GSM1: <- +CREG: 2,1,"2714","F822" OK
2016-05-20 11:19:26,6, GSM1: Modem is registered to the network
2016-05-20 11:19:26,6, GSM1: Selecting PDU mode
2016-05-20 11:19:26,7, GSM1: -> AT+CMGF=0
2016-05-20 11:19:26,7, GSM1: Command is sent, waiting for the answer
2016-05-20 11:19:27,7, GSM1: <- OK
2016-05-20 11:19:27,7, GSM1: -> AT+CMGS=23
2016-05-20 11:19:27,7, GSM1: Command is sent, waiting for the answer
2016-05-20 11:19:27,7, GSM1: <- >
2016-05-20 11:19:27,7, GSM1: -> 0011000A9190779878130000FF0BE8329BFD06D1D1657919^Z
2016-05-20 11:19:27,7, GSM1: Command is sent, waiting for the answer
2016-05-20 11:19:30,7, GSM1: <- +CMGS: 144 OK
2016-05-20 11:19:30,5, GSM1: SMS sent, Message_id: 144, To: 09778xxxxx, sending time 6 sec.
2016-05-20 11:19:30,6, GSM1: Moved file /var/spool/sms/checked/send_a9eVLo to /var/spool/sms/sent/send_a9eVLo
2016-05-20 11:19:34,5, smsd: Moved file /var/spool/sms/outgoing/send_GuKfeB to /var/spool/sms/checked
2016-05-20 11:19:34,6, GSM1: I have to send 1 short message for /var/spool/sms/checked/send_GuKfeB
2016-05-20 11:19:34,6, GSM1: Sending SMS from to 096680xxxxx
2016-05-20 11:19:34,6, GSM1: Checking if modem is ready

******here are the /var/log/smsd/smsd.log configs:**********

[root@nagiostest outgoing]# vim /usr/bin/smssend
# KEYS="5f4dcc3b5aa765d61d8327deb882cf99 4a5ea11b030ec1cfbc8b9947fdf2c872 "

KEYS=""

# When creating keys, remember to use -n for echo:
# echo -n "key" | md5sum

smsd_user="smsd"

# Will need echo which accepts -n argument:
ECHO=echo
case `uname` in
SunOS)
ECHO=/usr/ucb/echo
;;
esac

if ! [ -z "$KEYS" ]; then
printf "Key: "
read KEY
if [ -z "$KEY" ]; then
echo "Key required, stopping."
exit 1
fi

KEY=`$ECHO -n "$KEY" | md5sum | awk '{print $1;}'`
if ! echo "$KEYS" | grep "$KEY" >/dev/null; then
echo "Incorrect key, stopping."
exit 1
fi
fi

DEST=$1
TEXT=$2

if [ -z "$DEST" ]; then
printf "Destination(s): "
read DEST
if [ -z "$DEST" ]; then
echo "No destination, stopping."
exit 1
fi
fi

if [ -z "$TEXT" ]; then
printf "Text: "
read TEXT
if [ -z "$TEXT" ]; then
echo "No text, stopping."
exit 1
fi
fi

if [ $# -gt 2 ]; then
n=$#
while [ $n -gt 1 ]; do
destinations="$destinations $1"
shift
n=`expr $n - 1`
done
TEXT=$1
else

destinations=$DEST
fi

echo "-- "
echo "Text: $TEXT"

ALPHABET=""
if which iconv > /dev/null 2>&1; then
if ! $ECHO -n "$TEXT" | iconv -t ISO-8859-15 >/dev/null 2>&1; then
ALPHABET="Alphabet: UCS"
fi
fi

owner=""
if [ -f /etc/passwd ]; then
if grep $smsd_user: /etc/passwd >/dev/null; then
owner=$smsd_user
fi
fi

for destination in $destinations
do
echo "To: $destination"

TMPFILE=`mktemp /tmp/smsd_XXXXXX`

$ECHO "To: $destination" >> $TMPFILE
[ -n "$ALPHABET" ] && $ECHO "$ALPHABET" >> $TMPFILE
$ECHO "" >> $TMPFILE
if [ -z "$ALPHABET" ]; then
$ECHO -n "$TEXT" >> $TMPFILE
else
$ECHO -n "$TEXT" | iconv -t UNICODEBIG >> $TMPFILE
fi

if [ "x$owner" != x ]; then
chown $owner $TMPFILE
fi

FILE=`mktemp /var/spool/sms/outgoing/send_XXXXXX`
mv $TMPFILE $FILE
done.

********* vim /etc/smsd.conf******
# Example smsd.conf. Read the manual for a description

devices = GSM1
logfile = /var/log/smsd/smsd.log
incoming = /var/spool/sms/incoming
outgoing = /var/spool/sms/outgoing
checked = /var/spool/sms/checked
failed = /var/spool/sms/failed
sent = /var/spool/sms/sent
loglevel = 7
user = smstools
infofile = /var/run/smsd/smsd.working
pidfile = /var/run/smsd/smsd.pid
# 3.1.5 introduced smart logging
# once your configuration is OK, set log level lower (5 is good in most cases)
smart_logging = yes

[GSM1]
device = /dev/ttyUSB0
incoming = no
outgoing = yes
#init = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0

#pin = 1111
**********************************
how can this been resolved. Is there a way of giving permissions to the directory so that the incoming files are given the execution permissions?

Member
Registered:
Aug 2017
Location: Antartica, Antarctica
Hey men,

u need edit file "/usr/bin/smssend/"

and change this:

#smsd_user="smsd"
smsd_user="smstools"

Good luck :D

Login and Post Reply

Page:  1

SMSTools3 Community » Sample scripts / setups Top

 
Time in this board is UTC.  

Privacy Policy   SMS Server Tools 3 Copyright © Keijo Kasvi.