LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-15-2004, 05:07 PM   #1
m_a_b
Member
 
Registered: Aug 2003
Distribution: Ubuntu 6.10 Edgy
Posts: 90

Rep: Reputation: 15
run script as root in KDE


I am using the MadWiFi wireless networking drivers on a Mandrake system using KDE. I wrote a small file that will run all of the commands needed to enable the drivers:

Code:
#!/bin/bash
# Bring up MadWiFi

modprobe wlan
modprobe ath_pci
modprobe ath_hal
iwconfig ath0 ESSID wlanhome
ifup ath0
This file works just fine when I run it from the terminal as root. What I would like to do, though, is make an icon on the KDE desktop that will run this script. I added a new "Link to Application" and pointed it to the right file and set it to run as another user (in the advanced properties) and set that user to "root". When I doubleclick the link, it asks for the root pasword, then gives the following:

Quote:
Password:
/home/m_a_b/madwifi_up_home: line 4: modprobe: command not found
/home/m_a_b/madwifi_up_home: line 5: modprobe: command not found
/home/m_a_b/madwifi_up_home: line 6: modprobe: command not found
/home/m_a_b/madwifi_up_home: line 7: iwconfig: command not found
/home/m_a_b/madwifi_up_home: line 8: ifup: command not found
These are the same errors I get if I try to run the script in the terminal from anything but the root user. Does anyone know what I'm doing wrong? Ideally, when I doubleclick the file, it would prompt for the root password then run the script properly - enabling my wireless connection.
 
Old 10-15-2004, 05:39 PM   #2
Tamsco
Member
 
Registered: Jul 2004
Location: 1st Brillouin Zone
Distribution: Gentoo (not ricer Gentoo)
Posts: 165

Rep: Reputation: 30
The problem is that modprobe is a sbin, not a bin. Simply typing "su" will give the user root priviliedges but it will not open up the sbins. One would have to type "su -" for that.

I suggest you set up a sudo file to allow certain users administrative priviledges.
 
Old 10-15-2004, 05:52 PM   #3
ahh
Member
 
Registered: May 2004
Location: UK
Distribution: Gentoo
Posts: 293

Rep: Reputation: 31
I think if you add the full path in your script it will work, i.e.

/sbin/modprobe wlan
 
Old 10-15-2004, 07:00 PM   #4
m_a_b
Member
 
Registered: Aug 2003
Distribution: Ubuntu 6.10 Edgy
Posts: 90

Original Poster
Rep: Reputation: 15
thanks, ahh, that was an easy fix and it worked like a charm.
 
  


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
Run shell script as root automatically elempoimen Linux - Software 8 06-20-2010 01:24 AM
How to run a script as root upon login zugvogel Linux - Newbie 7 09-09-2005 11:10 AM
making a script run with root rights box_l Programming 12 02-10-2005 09:44 PM
PHP HOWTO : Run script as root guideweb Linux - Software 3 08-22-2004 11:38 PM
Need to run shell script as root kaloyer Programming 4 06-27-2004 09:01 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

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