PDA

View Full Version : Run specific lines as root.


loathsome
June 8th, 2007, 12:12 PM
Hi there,

How can I do something like this?


#!bin/bash

/usr/local/sbin/wifi # AS ROOT
/usr/local/sbin/mekk # NOT as root.


Thanks.

FuturePast
June 8th, 2007, 12:14 PM
Hi there,

How can I do something like this?


#!bin/bash

su -c /usr/local/sbin/wifi # AS ROOT
/usr/local/sbin/mekk # NOT as root.


Thanks.

?

loathsome
June 8th, 2007, 12:19 PM
Yeah, but if I initialize the script «sudo sh script.sh», everything will be run as root.

That's not what I want :)

FuturePast
June 8th, 2007, 12:22 PM
Then don't run the script as root!

(Use the sudo in the script if you want)