LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-08-2003, 06:06 PM   #1
melquiades
Member
 
Registered: Jul 2003
Location: Northern Scotland
Distribution: Slackware 9.1
Posts: 48

Rep: Reputation: 15
writing a script running firestarter automatically with kppp without root priviliges


I've installed firestarter under slackware 9.0 and am running kde 3.1 and kppp. now firestarter needs to be started AFTER the connection is up and running, which can be done in kppp. however in order to run firestarter I need root priviligies, and kppp can only execute user commands for the main user.
I was wondering if there is someway in which I can right an automatic script that will allow me to execute a 'su' command, pass it my root password and then run 'firestarter -s'. At the moment I have to start firestarter manually each time I connect using a shell console, su and then run the command. for obvious reasons I would like to start this automatically, but I don't know whether, or how, I can run su (with my password) and execute firestarter all from an automated script - all with only user priviligies for final execution of the script in kppp
Any and all help gratefully recieved, I'm sure there must be way but I don't understand about shell scripting. can anyone help me out?
 
Old 08-09-2003, 05:18 AM   #2
jpbedinger
LQ Newbie
 
Registered: Jul 2003
Distribution: Mandrake 9.1
Posts: 4

Rep: Reputation: 0
try this...

I had exactly the same problem, but in Mandrake. My directories will probably be different than yours (hopefully not the commands), and here is what I did(please mind the typos):

As root(superuser):
# cd /usr/sbin (or wherever your firestarter bin is)
# vim firekiller
Hit [Esc] then [i] to insert the following(note the backward '):

kill -HUP `ps -C firestarter -o pid =`

Now, hit [Esc] then [Z] then [Z] to save. Now,

# chmod +x firekiller

which creates a script to kill firestarter after hanging up on kppd.

Assuming you have the SUDO command and its config file sudoers is in /etc...

# cd /etc
# visudo

Hit [Esc] then [i] to include the following lines in the file:

#User Alias specification
User_Alias FIREUSERS = yourusernamehere1, username2here

#Cmnd Alias specification
Cmnd_Alias FIRESTART = /usr/sbin/firestarter -start
Cmnd_Alias FIREKILL = /usr/sbin/firekiller

#Samples
#Allowed Commands
FIREUSERS ALL = NOPASSWD: FIRESTART, FIREKILL

Hit [Esc] then [Z] then [Z] to save. If there is a typo, follow
its instructions and correct it. Try visudo again if unsure.
The NOPASSWD lets FIREUSERS group users execute only
FIRESTART and FIREKILL without a password.

In kppp, configure your execute settings in your dialing
profile to (I dont know the exact titles, but the order is right.)
[Before Dialing]:
[When Connected]: sudo /usr/sbin/firestarter -start
[Before Disconnect]:
[After Disconnect]: sudo /usr/sbin/firekiller

Save your profile, and give it a shot. Let me know if you run into problems. Keep in mind, I'm a newbie myself, and have only been on Linux about a week now...j.p.b.

Any Xperienced Linux gurus out there let me know if ive goofed..
(security exploits???)


 
Old 08-11-2003, 02:15 AM   #3
jpbedinger
LQ Newbie
 
Registered: Jul 2003
Distribution: Mandrake 9.1
Posts: 4

Rep: Reputation: 0
BTW,
kill -HUP `ps -C firestarter -o pid=`

is the correct line (i had an extra space in there)
anymore problems and let me know... ill be in canada for a few days though so dont excpect an instant reply
 
Old 08-11-2003, 06:50 AM   #4
melquiades
Member
 
Registered: Jul 2003
Location: Northern Scotland
Distribution: Slackware 9.1
Posts: 48

Original Poster
Rep: Reputation: 15
wow! thanks for the mini-tutorial, I'm having some more serious probs with my linux box at the moment, but as soon as that's fixed (should be by tonight) I'll have a go with your instructions,

many, many thanks dude, I'll let you know how I get on!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
can't use my root priviliges 47.46.45 Linux - Security 2 06-27-2005 02:31 PM
Automatically running script at shutdown samac Slackware 2 05-14-2005 10:10 AM
Root Priviliges Itsu SUSE / openSUSE 7 11-19-2004 08:42 PM
Running KPPP as a user, and not root. RoaCh Of DisCor Linux - Software 5 06-28-2004 05:38 AM
Writing init script for Firestarter on updated Fedora 1 (today) lrt2003 Fedora 5 04-18-2004 02:58 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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