roc has asked for the wisdom of the Perl Monks concerning the following question:

hi every one...i'm getting some problem with some permission issue..i have a cgi script to send sms ... it will receive details through form and work..i mean phone numbers,...... im using frdora 12 ....when i run the script as root i mean in command line the script connecting with gsm..but when i run as a user its not...i mean when as root (su -l root -c "/usr/bin/perl /path/to/script/script.cgi") then script giving the output as "connected" in command line.. but as user(su -l user -c "/usr/bin/perl /path/to/script/script.cgi") its giving "not connected" msg in terminal... i gave 755 permission for file. can any one tell me how to make the script to work for user. sorry for bad question formatting

Replies are listed 'Best First'.
Re: Problem with Permission
by almut (Canon) on Apr 22, 2010 at 16:22 UTC

    What are you using to send the SMS?  Presumably, whatever service you're using requires root permissions...  Try

    $ su -l user -c "strace -f /usr/bin/perl /path/to/script/script.cgi"

    to see whichever file access under the hood is returning with "EACCES (Permission denied)".

      hi thx for ur reply..i used the command...i got the following...... open("/dev/ttyACM0", O_RDWR|O_NOCTTY|O_NONBLOCK|O_LARGEFILE) = -1 EACCES (Permission denied)

        ...presumably the device that interfaces to the modem.  What's its group and the permissions? Maybe you can arrange for user to be in the appropriate group that would have write access?

Re: Problem with Permission
by proceng (Scribe) on Apr 23, 2010 at 01:18 UTC
    can any one tell me how to make the script to work for user.
    It would help if you uploaded as small a section of "script.cgi" as will duplicate the problem. Otherwise, we can not tell where in the script it is failing with the permission error.

    Another option (you do have use warnings; and use strict; don't you?) is to include print/warning/die statements as necessary to determine where the script is failing.