Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 09-25-2005, 04:11 PM   #1
Registered: May 2004
Distribution: Suse 9.2
Posts: 56

Rep: Reputation: 15
Operation not permitted

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)
off_t s;
int r;

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?
Old 09-26-2005, 10:41 AM   #2
Registered: Feb 2005
Location: Ontario, Canada
Distribution: Gentoo, Slackware
Posts: 345

Rep: Reputation: 30
Sorry, I'm not sure I quite understand your question.
Are you saying that the program runs as a priveleged (root) user but not as a normal user?

Note that the lower ports are reserved for root usage only and only the higher ports are accessible as a regular user. (Thus why apache must be started with root priveleges)
Old 09-26-2005, 04:11 PM   #3
Registered: May 2004
Distribution: Suse 9.2
Posts: 56

Original Poster
Rep: Reputation: 15
the program can only run as a root user due to its nature. apache does not run as this user (should not anyways). How can I execute this program using php in apache?
Old 09-26-2005, 08:30 PM   #4
Senior Member
Registered: Aug 2004
Location: Munich, Germany
Distribution: Opensuse 11.2
Posts: 1,549

Rep: Reputation: 52
apache does not run as this user (should not anyways)
Apache does actually start as root always. On a properly configured systems it will then fork off one or more child processes running as a non-priveleged user to handle requests. However the initial stub process still has to run in order to stay bound to the port. Do a ps -ef on your apache system and you should see an apache process started as root.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
su - operation not permitted jrtayloriv Linux - Newbie 2 06-09-2005 10:27 PM
Operation not permitted as root? Amfohr Linux - Newbie 6 06-07-2005 07:12 AM
su - mysql operation not permitted mjl3434 Slackware 1 02-04-2005 02:52 AM
operation not permitted jamaso Slackware 2 05-08-2004 06:55 AM
Operation not permitted FrozenShadow23 Linux - Newbie 6 10-05-2003 06:13 PM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:52 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration