LinuxQuestions.org
Review your favorite Linux distribution.
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 09-29-2005, 03:19 PM   #1
Janusz11
Member
 
Registered: Aug 2005
Distribution: Zenwalk
Posts: 42

Rep: Reputation: 15
Question pppoe-start as user


Can someone please tell me what I have to do so that I can start and stop my internet connection via "pppoe-start" and "pppoe-stop" as a normal user.

At the moment I can start and stop my internet connection only as root.
 
Old 09-29-2005, 03:22 PM   #2
phil.d.g
Senior Member
 
Registered: Oct 2004
Posts: 1,192

Rep: Reputation: 101Reputation: 101
I don't know about running at as a normal user, but (in my mind) the easiest and safest method would be set up sudo to allow a normal user to run the commands.

So you would do
Code:
sudo pppoe-start
 
Old 09-30-2005, 01:45 PM   #3
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,891

Rep: Reputation: 569Reputation: 569Reputation: 569Reputation: 569Reputation: 569Reputation: 569
run 'visudo' to change the access rights for users in the /etc/sudoers file.
 
Old 10-01-2005, 04:03 AM   #4
carboncopy
Senior Member
 
Registered: Jan 2003
Location: Malaysia
Distribution: Fedora Core, Slackware, Mac OS X, Debian, OpenSUSE
Posts: 1,210
Blog Entries: 4

Rep: Reputation: 45
Re: pppoe-start as user

Quote:
Originally posted by Janusz11
Can someone please tell me what I have to do so that I can start and stop my internet connection via "pppoe-start" and "pppoe-stop" as a normal user.

At the moment I can start and stop my internet connection only as root.
I have mine start at the machine start-up since it is unlimited anyway.

Here is how my /etc/rc.d/rc.pppoe looks like:
Code:
#!/bin/bash
#
case "$1" in
   'start')
      /usr/sbin/pppoe-start 
      /usr/sbin/pppoe-status ;;
   'stop')
      /usr/sbin/pppoe-stop 
      /usr/sbin/pppoe-status ;;
   'restart')
      /usr/sbin/pppoe-stop 
      /usr/sbin/pppoe-start
      /usr/sbin/pppoe-status ;;
   *)
      echo "usage $0 start|stop|restart" ;;
esac
And I insert the following into beginning of /etc/rc.d/rc.inet2

Code:
##
## Modified by carboncopy to startup ADSL
##
if [ -x /etc/rc.d/rc.adsl ]; then
    echo "Connecting to YOUR_ISP_NAME: pppoe-start"
    /etc/rc.d/rc.pppoe start
fi

Why did I set it up in /etc/rc.d/rc.inet2 because of this line:

Code:
# At this point, we are ready to talk to The World...
You could just include the few lines above into /etc/rc.d/rc.local instead. Probably the correct way of doing things.
 
Old 10-02-2005, 07:57 AM   #5
Janusz11
Member
 
Registered: Aug 2005
Distribution: Zenwalk
Posts: 42

Original Poster
Rep: Reputation: 15
Thanks for your help!

Unfortunately, putting meself into the sudoers file didn't help. I tried different combinations, like
Code:
 
ITS_ME ALL=NOPASSWD:/usr/sbin/pppoe-start
ITS_ME ALL=NOPASSWD:/usr/sbin/pppoe-stop
and
Code:
ITS_ME ALL=(ALL) /usr/sbin/pppoe-start
ITS_ME darkstar=(ALL) /usr/sbin/pppoe-start
The result is always the same: first I have to be at /usr/sbin so that the command "sudo pppoe-start" could even be recognised and then I get the following error message:
Code:
Sorry, user ITS_ME is not allowed to execute 'pppoe-start' as root on darkstar.
But your script carboncopy was of great help to me! I finally managed to get access to the internet without root privileges. And that's how I did it:

1. I created a script with parts of carboncopy's code called "adsl" at /usr/local/bin, which I made executable with sudo privileges

2. I made it executable by all users, but only editable by root:
Code:
chown root.root /usr/local/bin/adsl
chmod a+rx /usr/local/bin/adsl
3. Put the following line into /etc/sudoers:
Code:
 
%users ALL=(ALL) /usr/local/bin/adsl
And now I can start and stop my internet connection with "sudo adsl start" and "sudo adsl stop".
This is how the script looks like:
Code:
#!/bin/sh
# Script /usr/local/bin/adsl

SUDO="/usr/bin/sudo"

# start script by sudo when
# not started by root
if [ -x $SUDO -a $UID -ne 0 ]; then
    exec $SUDO $0 $*
fi

case "$1" in
   'start')
      /usr/sbin/pppoe-start ;;
   'stop')
      /usr/sbin/pppoe-stop ;;
   'restart')
      /usr/sbin/pppoe-stop
      /usr/sbin/pppoe-start ;;
   'status')
      /usr/sbin/pppoe-status ;;
   *)
      echo "usage: $0 start|stop|restart|status" ;;
esac
Thanks again!
 
  


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
pppoe for normal user snu Linux - Security 3 02-11-2006 10:10 PM
Doesnt recognize "start-pppoe" command? grazak Linux - Software 1 03-29-2005 11:43 AM
adsl-status can't read pppoe PID file with rp-pppoe program setup Smarvy Linux - Newbie 2 03-13-2004 11:35 PM
cannot start kdeas user ,can start icewm,fluxbox jackren Debian 1 02-29-2004 11:06 PM
GUI (KDE,Gnome) needs 5 min. to start with pppoe active.. TarasBulba Linux - Networking 2 12-26-2003 04:14 AM

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

All times are GMT -5. The time now is 08:09 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration