LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
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.

Notices


Reply
  Search this Thread
Old 03-08-2012, 03:21 PM   #1
Omar Ali Mokhar
LQ Newbie
 
Registered: Mar 2012
Posts: 2

Rep: Reputation: Disabled
Question Executable file privileges ..


Dear All,

How can i control the privileges of an executable file ? For example, I have an executable file that i don't want to allow it to read another file or write to it even if it asked to. And i don't want it to connect to a socket. And i don't want it to execute a linux command (using "system(COMMAND_STRING)" for example). I just want it for printf and scanf only.

How can this be done ?

Thanks in advance,
 
Old 03-08-2012, 07:56 PM   #2
hydraMax
Member
 
Registered: Jul 2010
Location: Skynet
Distribution: Debian + Emacs
Posts: 467
Blog Entries: 60

Rep: Reputation: 51
If you are working with Linux, you can use a nifty kernel feature called seccomp:

https://en.wikipedia.org/wiki/Seccomp

The basic idea is that the program opens any files it needs to read from or write to, and then the program tells the kernel it wants to switch to seccomp code. Once in seccomp mode, the kernel will not allow the process to open any new files or use any system calls except for read(), write(), exit(), and sigreturn(). If the process tries to do so, it will receive a swift and brutal SIGKILL from the kernel.

That's an internal way of handling it. Of course, there are external options like grsec, selinux, and apparmor, but you have to change your entire system to use them.
 
Old 03-09-2012, 12:00 AM   #3
Omar Ali Mokhar
LQ Newbie
 
Registered: Mar 2012
Posts: 2

Original Poster
Rep: Reputation: Disabled
Thanks very much .. It worked !
 
  


Reply



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
User executable script gaining root privileges w/o passwd neoAKiRAz Linux - General 6 09-06-2007 04:22 PM
Howto convert bin file to a executable DOS file lilzz Linux - Newbie 5 08-04-2006 12:03 AM
file system privileges between installations belliott4488 Linux - General 4 03-04-2005 02:13 AM
Default File Access Privileges..! br_sriram Linux - Software 0 09-28-2004 11:10 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 08:43 AM.

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