shortcut icon to a script that needs root access

Discussion in 'Linux' started by indieman, Feb 13, 2009.

  1. indieman

    indieman

    Joined:
    Jan 17, 2009
    Messages:
    1
    Likes Received:
    0
    Hi,

    I am a linux noob but have a quick question. I have searched through the forums and used the search facility but cant find the answer to this.

    What i have is a mobile phone running WMWifiRouter. I can connect to it fine using the following commands:

    /etc/rc.d/init.d/NetworkManager stop
    ifconfig ath0 down
    wlanconfig ath0 destroy
    wlanconfig ath0 create wlandev wifi0 wlanmode ad-hoc
    iwconfig ath0 channel 11
    iwconfig ath0 essid benWifiRouter
    ifconfig ath0 up
    dhclient ath0

    I have put the above into a file called connect.sh and did chmod +x on it.
    but to run this script you need to be root for it to execute fully.

    I have read how to modify a .desktop file to run an sh script rather than an app but when i do this it fails because its running as the user.
    I have tried adding "sudo" at the beginning of the first line but this didn't work.
    I have tried adding "su root" at the beginning but this just prompted for the password and didn't execute the rest of the script.

    has anybody an idea of how to get this all working?


    many thanks,
    indieman
     
    indieman, Feb 13, 2009
    #1
  2. indieman

    mattytee

    Joined:
    Nov 30, 2008
    Messages:
    112
    Likes Received:
    1
    try "sudo su" as the first line or alternately just paste "sudo" before every line.
     
    mattytee, Feb 15, 2009
    #2
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.