Results 1 to 8 of 8
Hi.
Sorry if this is of topic....
I have made a program that controls some step-motors on the parallel port. Everything is working fine when I use the command
Code:
...
- 09-11-2009 #1
ioperm: Operation not permitted
Hi.
Sorry if this is of topic....
I have made a program that controls some step-motors on the parallel port. Everything is working fine when I use the command
But...Code:sudo ./cam-control
When I try to run the program as a normal user...
I get the following error:Code:./cam-control
ioperm: Operation not permitted
I think it has something with reading/writing to the parallel port.
How do I let normal users run this program?
j1s
- 09-11-2009 #2Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 8,974
Low-level io calls are privileged - they have to be run by root. This is to keep badly written user applications from munging the system to a FUBAR state. I'm not sure if making root the owner of the process will help, but normally what I would do here is to create a server process run by root (or sudo'd) that does the actual port manipulations (kind of like a print server), and have my applications send messages to the server that tell it what ports to twiddle. If you don't want the IPC overhead that entails, then you can make root the owner of the process and enable the setuid bit on it ( chmod +s procname ). Bear in mind that this is a security hole and only do that if you have carefully vetted the process and make it only executable by members of the camcontrol group (for example).
Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!
- 09-12-2009 #3
Thank You. I will try to chmod +s procname (/dev/lp0 ?)
j1s
- 09-14-2009 #4Just Joined!
- Join Date
- Mar 2008
- Location
- Chennai, India
- Posts
- 26
- 09-14-2009 #5
- 09-18-2009 #6Just Joined!
- Join Date
- Mar 2008
- Location
- Chennai, India
- Posts
- 26
- 09-18-2009 #7
I have Debian - I don't have that command and I don't know in what package it might be found...
But, I can explain how it probably works:
Basically, as has been mentioned, the calls which grant IO permissions to processes are restricted to the superuser - so to run them you either need to be logged in as root, or you need to run a SUID root binary to get those privileges...
The man pages for ioperm and iopl describe the conditions in which the permissions granted may be inherited by other processes: ioperm() doesn't make it across a fork() call, but it does make it past an exec() call. So ppdo presumably is a SUID root binary which calls ioperm() then sets your UID to remove all root privileges, then calls exec() for the program you wanted to run in the first place...
- 09-18-2009 #8
Didn't work for me...

When I chmod -s cam-control I get an error telling me that the port is not accessible.
My installastion is a Ubuntu 9.04 with build-essentals


Reply With Quote
