1

I am using a Makefile to compile my C program and want to make the executable setuid. How can I set the permissions using the Makefile?

user1190650
  • 3,207
  • 6
  • 27
  • 34

2 Answers2

3

The same way you would from the command line (chmod u+s .....) - just have it be the line after you've created the executable

note too that that you could, in addition, do a sudo chown root:root .....

KevinDTimm
  • 14,226
  • 3
  • 42
  • 60
1

If your environment has install utility you can do it like:

install: program
    install -m 4755 -o root program /usr/local/bin

.PHONY: install
Ochko
  • 121
  • 1
  • 5