LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 08-28-2007, 01:22 PM   #1
bab258
LQ Newbie
 
Registered: Aug 2007
Posts: 5

Rep: Reputation: 0
Root for all


I wrote a program wich using ifconfig utility. So to run my program correctly user must be root. How can I let to run this program for all users in system. Only read and execution allowed.
 
Old 08-28-2007, 01:30 PM   #2
reddazz
LQ Guru
 
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298

Rep: Reputation: 77
Not sure if this is safe, but you could make the program setuid e.g.
Code:
#chmod o+s /path/to/prog

Last edited by reddazz; 08-28-2007 at 01:36 PM.
 
Old 08-28-2007, 01:31 PM   #3
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
well the initial angle you should look at is how to not be in this situation in the first place... what is ifconfig doing? if it's reading data then just reference it absolutely, i.e /sbin/ifconfig and it'll work fine. for actaully making data changes (please explain why if so...) then you could set the script a sticky for the owner (chmod o+s myscript) whch will then allow the ifconfig command to be run as root when it needs to. better still is probably the use of sudo to control access in a more scalable auditable manner.
 
Old 08-28-2007, 03:35 PM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Like said before please use Sudo. Introducing more setuid root binaries on your system is not necessary and may pose a security risk.
 
Old 08-29-2007, 05:05 AM   #5
nx5000
Senior Member
 
Registered: Sep 2005
Location: Out
Posts: 3,307

Rep: Reputation: 57
On a default system, /sbin/ifconfig *for read access* doesn't need root priv because it reads /proc
It's simply not in the default path of normal users so you need to put the complete path (/sbin/ifconfig)
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding root privaliges to user accounts or auto login as root Val-Ent Linux - General 15 03-02-2010 04:27 PM
why lftp command run failed when user isn't root, but ok when logining as root steven_yu Linux - Software 0 06-06-2007 08:36 PM
RHEL3 Mounting USB after reboot and between reboots: root and non-root users Luis Nunes Linux - Hardware 0 07-20-2005 08:32 AM
IntelliMouse thumb buttons work as root, broken as non-root user, wheel works always digital vortex Linux - Hardware 7 03-02-2004 04:14 PM
root files: create as root:root or root:wheel? pcass Linux - Security 1 02-07-2004 04:14 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 07:46 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