LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 03-28-2005, 12:40 PM   #1
Vindane
Member
 
Registered: Jan 2004
Location: Indiana
Distribution: Fedora
Posts: 117

Rep: Reputation: 15
initiate program as root


I'm writing a script to connect to my wireless lan when I click on it. I've looked on google but can't seem to find what I'm looking for. I need to be root when these certain commands are given. My question is should I include the su command in my script? Or should I include the su command in my icon during the command call?

Code:
#! /bin/bash
# Script to connect to wireless lan.

modprobe ndiswrapper
iwconfig wlan0 mode Managed
iwconfig wlan0 key restricted 9999999999
iwconfig wlan0 essid ESSID
dhcpcd wlan0

Last edited by Vindane; 03-28-2005 at 12:42 PM.
 
Old 03-28-2005, 01:57 PM   #2
XavierP
Moderator
 
Registered: Nov 2002
Location: Kent, England
Distribution: Debian Testing
Posts: 19,192
Blog Entries: 4

Rep: Reputation: 475Reputation: 475Reputation: 475Reputation: 475Reputation: 475
I'd set the permissions on that file to be only usable as root, it should then prompt you for a password.
 
Old 03-28-2005, 02:23 PM   #3
gbonvehi
Senior Member
 
Registered: Jun 2004
Location: Argentina (SR, LP)
Distribution: Slackware
Posts: 3,145

Rep: Reputation: 53
Make another script with these lines:
Code:
#! /bin/bash
su -c 'yourscripttogetwireless.sh'
or
Code:
#! /bin/bash
# Script to connect to wireless lan.

su -c 'modprobe ndiswrapper ; iwconfig wlan0 mode Managed ; iwconfig wlan0 key restricted 9999999999 ; iwconfig wlan0 essid ESSID ; dhcpcd wlan0'


Oh, you could also take a look at sudo ('man sudo' and 'man sudoers') to see how to enable certain user to execute certain commands.

Last edited by gbonvehi; 03-28-2005 at 02:26 PM.
 
  


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
Getting Firefox to initiate kppp connection. wuberman Linux - General 1 06-14-2005 10:31 AM
Linux won't initiate anymore daphne.v Programming 2 11-08-2003 03:32 AM
Mouse settings do not initiate on startup linuXBOX Linux - Software 7 10-25-2003 10:07 PM
System failed to initiate! paranoia1980 Linux - General 2 06-25-2003 04:48 PM
Evolution won't initiate mohapi Linux - Software 3 03-10-2003 09:48 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

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