Set User ID bit

Hi,
We have ceratin executable files that only the root can modify but can be
exectuted by any user. We set permissions (chmod )on these files so that
any user can execute them. But when any of these files are updated the
permissions get reset. How can this be avoided?

Thank you,
Shashank

Shashank <sbalijepalli@precitech.com> wrote:

Hi,
We have ceratin executable files that only the root can modify but can be
exectuted by any user. We set permissions (chmod )on these files so that
any user can execute them. But when any of these files are updated the
permissions get reset. How can this be avoided?

How are you doing the update?

-David

QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.

For example if you make some changes to the source files and rebuild the
files.

Thank you,
Shashank

“David Gibbs” <dagibbs@qnx.com> wrote in message
news:appcb3$drj$1@nntp.qnx.com

Shashank <> sbalijepalli@precitech.com> > wrote:
Hi,
We have ceratin executable files that only the root can modify but can
be
exectuted by any user. We set permissions (chmod )on these files so
that
any user can execute them. But when any of these files are updated the
permissions get reset. How can this be avoided?

How are you doing the update?

-David

QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.

Shashank wrote:

For example if you make some changes to the source files and rebuild the
files.

You can add a chmod to your makefile after the link, for example:


xxx: xxx.o
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ xxx.o
chmod 4755 $@

Richard


Thank you,
Shashank

“David Gibbs” <> dagibbs@qnx.com> > wrote in message
news:appcb3$drj$> 1@nntp.qnx.com> …

Shashank <> sbalijepalli@precitech.com> > wrote:

Hi,
We have ceratin executable files that only the root can modify but can

be

exectuted by any user. We set permissions (chmod )on these files so

that

any user can execute them. But when any of these files are updated the
permissions get reset. How can this be avoided?

How are you doing the update?

-David

QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.

Shashank <sbalijepalli@precitech.com> wrote:

For example if you make some changes to the source files and rebuild the
files.

Doesn’t seem to happen for me:


Script started on Wed Oct 30 18:08:37 2002
[88]<1>/home/dagibbs > ls -l a
-rwsr-xr-x 1 dagibbs techies 6180 Oct 30 18:07 a*
[88]<2>/home/dagibbs > cc -o a timer.c
/usr/watcom/10.7/bin/wcc386 -zq -ms -3r -i=/usr/include -i=/usr/watcom/10.7/usr/include timer.c >
/usr/watcom/10.7/bin/wlink op quiet form qnx flat na a op priv=3 op c libp /usr/lib:/usr/watcom/10.7/usr/lib:. f /home/dagibbs/timer.o op offset=40k op st=32k >
[88]<3>/home/dagibbs > ls -l a
-rwsr-xr-x 1 dagibbs techies 6180 Oct 30 18:08 a*
[88]<4>/home/dagibbs > exit

Script done on Wed Oct 30 18:08:53 2002

Do you have a makefile that happens to delete the target or something
before building it?

-David

QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.

Sorry David I just sent that to you.

make sure your make utility has the same permissions as you want your
program to be. Make seems to give its properties to the build. It needs to
be the base make function and not its links.

“David Gibbs” <dagibbs@qnx.com> wrote in message
news:apppjm$m03$1@nntp.qnx.com
Shashank <sbalijepalli@precitech.com> wrote:

For example if you make some changes to the source files and rebuild the
files.

Doesn’t seem to happen for me:


Script started on Wed Oct 30 18:08:37 2002
[88]<1>/home/dagibbs > ls -l a
-rwsr-xr-x 1 dagibbs techies 6180 Oct 30 18:07 a*
[88]<2>/home/dagibbs > cc -o a timer.c
/usr/watcom/10.7/bin/wcc386 -zq -ms -3r -i=/usr/include -i=/usr/watcom/10.7/
usr/include timer.c >
/usr/watcom/10.7/bin/wlink op quiet form qnx flat na a op priv=3 op c libp
/usr/lib:/usr/watcom/10.7/usr/lib:. f /home/dagibbs/timer.o op offset=40k op
st=32k >
[88]<3>/home/dagibbs > ls -l a
-rwsr-xr-x 1 dagibbs techies 6180 Oct 30 18:08 a*
[88]<4>/home/dagibbs > exit

Script done on Wed Oct 30 18:08:53 2002

Do you have a makefile that happens to delete the target or something
before building it?

-David

QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.

Hi,
Could I use the “setuid” function in my program to allow a non-root user
run an application created by the root? If so, how?

Thank you,
Shashank

“Shashank” <sbalijepalli@precitech.com> wrote in message
news:appag7$rqg$1@inn.qnx.com

Hi,
We have ceratin executable files that only the root can modify but can be
exectuted by any user. We set permissions (chmod )on these files so that
any user can execute them. But when any of these files are updated the
permissions get reset. How can this be avoided?

Thank you,
Shashank

Shashank <sbalijepalli@precitech.com> wrote:

Hi,
Could I use the “setuid” function in my program to allow a non-root user
run an application created by the root? If so, how?

A non-root user can normally run a program created by root. What the
setuid bit does, is it says that when you run the program, you don’t
run as yourself, instead you run as the owner of the program…so a
regular user running a program owned by root, setuid bit set, will have
root permissions and privileges while that program is running.

-David


QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.