LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-19-2005, 08:31 PM   #1
Jerkstore
LQ Newbie
 
Registered: Dec 2005
Distribution: Slackware 10.2
Posts: 6

Rep: Reputation: 0
Shell scripting question(permissions)


I have a simple script written to connect to my mosre common wireless access points, and it uses ifconfig and iwconfig....is there a way to set permissions on this to run as root always without having to su and enter a password??

so if I run it as a normal user then it will still turn on my wireless card and activate the connection as root/super user?
 
Old 12-19-2005, 08:58 PM   #2
ilikejam
Senior Member
 
Registered: Aug 2003
Location: Glasgow
Distribution: Fedora / Solaris
Posts: 3,109

Rep: Reputation: 97
Hi.

In short, no. Linux doesn't allow setuid scripts.

What you could do is make the iwconfig and ifconfig binaries setuid with: (as root)
Code:
chmod +s /sbin/iwconfig /sbin/ifconfig
It's a bit of a a security risk, but if it's just you on the system, then I'd think it's probably OK.

Dave
 
Old 12-20-2005, 05:14 AM   #3
denver1980
Member
 
Registered: Dec 2004
Location: Québec
Distribution: Gentoo, Kubuntu Karmic
Posts: 48

Rep: Reputation: 15
Less risky in case of security breach would be to copie the two binaries to another name less significant name and chmod them
 
Old 12-20-2005, 06:08 AM   #4
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: Mint, Armbian, NetBSD, Puppy, Raspbian
Posts: 3,515

Rep: Reputation: 239Reputation: 239Reputation: 239
you could specify it in your sudoers file.

Quote:
By default, sudo requires that a user authenticate him or herself before running a command. This behavior can be modified via the NOPASSWD tag. Like a Runas_Spec, the NOPASSWD tag sets a default for the commands that follow it in the Cmnd_Spec_List. Conversely, the PASSWD tag can be used to reverse things. For example:

ray rushmore = NOPASSWD: /bin/kill, /bin/ls, /usr/bin/lprm

would allow the user ray to run /bin/kill, /bin/ls, and /usr/bin/lprm as root on the machine rushmore as root without authenticating himself. If we only want ray to be able to run /bin/kill without a password the entry would be:

ray rushmore = NOPASSWD: /bin/kill, PASSWD: /bin/ls, /usr/bin/lprm
 
Old 12-20-2005, 11:59 PM   #5
Jerkstore
LQ Newbie
 
Registered: Dec 2005
Distribution: Slackware 10.2
Posts: 6

Original Poster
Rep: Reputation: 0
and where would I find this sudoers file?
 
Old 12-21-2005, 12:38 AM   #6
denver1980
Member
 
Registered: Dec 2004
Location: Québec
Distribution: Gentoo, Kubuntu Karmic
Posts: 48

Rep: Reputation: 15
in /etc/sudoers.
If you are not familiar with the syntax, use /usr/sbin/visudo to modify it ... il will help you a bit
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
a shell-scripting question: mrchaos Slackware 3 09-22-2005 11:00 AM
Shell scripting question. dragin33 Linux - General 2 08-11-2004 05:17 PM
Shell Scripting Question b_vasu Linux - Newbie 1 11-21-2003 02:10 PM
Shell Scripting Question jester_69 Programming 13 11-05-2003 06:55 PM
Shell Scripting Question chrisk5527 Linux - General 12 07-09-2003 03:36 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

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