I get the following when running a program as a normal user (not root):
wwwrun@fsx01:~> /usr/local/bin/k74 1 set
/dev/port: Operation not permitted
Here is the code that sets the bit on 0x378 (parport 0) - c code:
void out_byte(int port, unsigned char byte)
s = lseek(dev_port_fd, port, 0);
if (s < 0) perror("lseek");
else if (s != port)
fprintf(stderr, "hmmm: seeking to %d, went to %ld.\n", port, (long)s);
r = write(dev_port_fd, &byte, 1);
if (r != 1)
fprintf(stderr, "hmmm: write returned %d\n", r);
if (r < 0) perror("write");
I have tried numerous options such as setting read-write on the devices and /dev/port and the app (k74) etc, nothing works.
I want to do this because I want php to execute the command (remote control garden system via wap). At this stage I have added apache to the sudoers list and it works. When running the command as apache in CONSOLE, it works fine, but as soon as I run it using php (web): shell_exec,exec,passthru, nothing happen
Any ideas anyone?