Inp and outp

Dear All,

I have a program that is using “inp” and “outp”.
I can make it work when login as root, but if I run it under another login,
I have the message “Operation not permitted”.

What can I do to make it work under any user?

Thank you for your help
Regards
Michele D

MicheleD <dMichele@ibelgique.com> wrote:
M > Dear All,

M > I have a program that is using “inp” and “outp”.
M > I can make it work when login as root, but if I run it under another login,
M > I have the message “Operation not permitted”.

M > What can I do to make it work under any user?

If you want it to run as non-root, then you have to set-uid to root.
The bottom line is that inp and outp are privledged instructions.

I’ve already tried to do that (using the setuid(0) function in the program)
But that does not change anything to the problem


“Bill Caroselli” <qtps@earthlink.net> wrote in message
news:c4h5ir$s6l$3@inn.qnx.com

MicheleD <> dMichele@ibelgique.com> > wrote:
M > Dear All,

M > I have a program that is using “inp” and “outp”.
M > I can make it work when login as root, but if I run it under another
login,
M > I have the message “Operation not permitted”.

M > What can I do to make it work under any user?

If you want it to run as non-root, then you have to set-uid to root.
The bottom line is that inp and outp are privledged instructions.

Nice try. I’d really panic if it worked.

If your program is non-root, then it does not have the privlege to execute
the function setuid(0).

That would be an RBT if it worked!

After compiling and linking you need to execute:
chown 0 my_program
chmod u+s my_program

Keep in mind that you’ll need to be root to execute those commands.

You can put this in your make file. But then, you must either make as root
or wrap these two commands in a ‘su’ command.

Also, keep in mind that once your program is setuid root IT must be smart
enough to prevent a malicious user from doing things they shouldn’t do.

NOTE: RBT == Really Bad Thing


MicheleD <dMichele@ibelgique.com> wrote:
M > I’ve already tried to do that (using the setuid(0) function in the program)
M > But that does not change anything to the problem


M > “Bill Caroselli” <qtps@earthlink.net> wrote in message
M > news:c4h5ir$s6l$3@inn.qnx.com

MicheleD <> dMichele@ibelgique.com> > wrote:
M > Dear All,

M > I have a program that is using “inp” and “outp”.
M > I can make it work when login as root, but if I run it under another
M > login,
M > I have the message “Operation not permitted”.

M > What can I do to make it work under any user?

If you want it to run as non-root, then you have to set-uid to root.
The bottom line is that inp and outp are privledged instructions.

“MicheleD” <dMichele@ibelgique.com> wrote in message
news:c4h6ol$7f$1@inn.qnx.com

I’ve already tried to do that (using the setuid(0) function in the
program)

You can’t do that. If you could any program could become root and
compromise the system.

Try chmod +s instead

But that does not change anything to the problem


“Bill Caroselli” <> qtps@earthlink.net> > wrote in message
news:c4h5ir$s6l$> 3@inn.qnx.com> …
MicheleD <> dMichele@ibelgique.com> > wrote:
M > Dear All,

M > I have a program that is using “inp” and “outp”.
M > I can make it work when login as root, but if I run it under another
login,
M > I have the message “Operation not permitted”.

M > What can I do to make it work under any user?

If you want it to run as non-root, then you have to set-uid to root.
The bottom line is that inp and outp are privledged instructions.

Also don’t forget you need to call ThreadCtl(_NTO_TCTL_IO, 0) to gain
privity to do I/O operations in the first place.


Cheers,
Adam

QNX Software Systems Ltd.
[ amallory@qnx.com ]

With a PC, I always felt limited by the software available.
On Unix, I am limited only by my knowledge.
–Peter J. Schoenster <pschon@baste.magibox.net>

“Bill Caroselli” <qtps@earthlink.net> wrote in message
news:c4hi8d$9gl$1@inn.qnx.com

Nice try. I’d really panic if it worked.

If your program is non-root, then it does not have the privlege to execute
the function setuid(0).

That would be an RBT if it worked!

After compiling and linking you need to execute:
chown 0 my_program
chmod u+s my_program

Keep in mind that you’ll need to be root to execute those commands.

You can put this in your make file. But then, you must either make as
root
or wrap these two commands in a ‘su’ command.

Also, keep in mind that once your program is setuid root IT must be
smart
enough to prevent a malicious user from doing things they shouldn’t do.

NOTE: RBT == Really Bad Thing


MicheleD <> dMichele@ibelgique.com> > wrote:
M > I’ve already tried to do that (using the setuid(0) function in the
program)
M > But that does not change anything to the problem


M > “Bill Caroselli” <> qtps@earthlink.net> > wrote in message
M > news:c4h5ir$s6l$> 3@inn.qnx.com> …
MicheleD <> dMichele@ibelgique.com> > wrote:
M > Dear All,

M > I have a program that is using “inp” and “outp”.
M > I can make it work when login as root, but if I run it under
another
M > login,
M > I have the message “Operation not permitted”.

M > What can I do to make it work under any user?

If you want it to run as non-root, then you have to set-uid to root.
The bottom line is that inp and outp are privledged instructions.

If you’re using QNX4, ignore what I said. :slight_smile: Just make sure that your
application is linked for privity 1 (check out the docs on inp() or the
cc -T option).


Cheers,
Adam

QNX Software Systems Ltd.
[ amallory@qnx.com ]

With a PC, I always felt limited by the software available.
On Unix, I am limited only by my knowledge.
–Peter J. Schoenster <pschon@baste.magibox.net>

“Adam Mallory” <amallory@qnx.com> wrote in message
news:c4hojo$e92$1@inn.qnx.com

Also don’t forget you need to call ThreadCtl(_NTO_TCTL_IO, 0) to gain
privity to do I/O operations in the first place.


Cheers,
Adam

QNX Software Systems Ltd.
[ > amallory@qnx.com > ]

With a PC, I always felt limited by the software available.
On Unix, I am limited only by my knowledge.
–Peter J. Schoenster <> pschon@baste.magibox.net

“Bill Caroselli” <> qtps@earthlink.net> > wrote in message
news:c4hi8d$9gl$> 1@inn.qnx.com> …
Nice try. I’d really panic if it worked.

If your program is non-root, then it does not have the privlege to
execute
the function setuid(0).

That would be an RBT if it worked!

After compiling and linking you need to execute:
chown 0 my_program
chmod u+s my_program

Keep in mind that you’ll need to be root to execute those commands.

You can put this in your make file. But then, you must either make as
root
or wrap these two commands in a ‘su’ command.

Also, keep in mind that once your program is setuid root IT must be
smart
enough to prevent a malicious user from doing things they shouldn’t do.

NOTE: RBT == Really Bad Thing


MicheleD <> dMichele@ibelgique.com> > wrote:
M > I’ve already tried to do that (using the setuid(0) function in the
program)
M > But that does not change anything to the problem


M > “Bill Caroselli” <> qtps@earthlink.net> > wrote in message
M > news:c4h5ir$s6l$> 3@inn.qnx.com> …
MicheleD <> dMichele@ibelgique.com> > wrote:
M > Dear All,

M > I have a program that is using “inp” and “outp”.
M > I can make it work when login as root, but if I run it under
another
M > login,
M > I have the message “Operation not permitted”.

M > What can I do to make it work under any user?

If you want it to run as non-root, then you have to set-uid to root.
The bottom line is that inp and outp are privledged instructions.