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 03-13-2007, 05:57 AM   #1
s26c.sayan
Member
 
Registered: Nov 2006
Location: Kolkata, India
Distribution: Arch Linux, Ubuntu Feisty, Knoppix Live CD
Posts: 37

Rep: Reputation: 15
Allow normal user to connect to net using ADSL


Hi!!

I am using Arch Linux. I use /etc/rc.d/adsl start to connect to internet, but this has to be done as ROOT!

How can I allow a normal user to connect to net using the same way??
 
Old 03-13-2007, 06:34 AM   #2
lurko
Member
 
Registered: Jun 2006
Location: Ontario, Canada
Distribution: Debian
Posts: 448

Rep: Reputation: 35
#chmod o+x /etc/rc.d/adsl ??

there might be security implications to that though, idk.
 
Old 03-13-2007, 07:18 AM   #3
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670
You could use the "visudo" program to configure sudo to allow users to enter the command. Look at the commented examples on mounting a CDROM. You can use that as a model for a command that runs your script instead.
 
Old 03-13-2007, 10:19 AM   #4
berbae
Member
 
Registered: Jul 2005
Location: France
Distribution: Arch Linux
Posts: 540

Rep: Reputation: Disabled
Hi
If you want a permanent connexion, it's easier to add the 'adsl' script to /etc/rc.conf file :
DAEMONS=(... network ... adsl ...)
That will run 'adsl start' at boot time after the network start, and stop it at shutdown time.
(The '...' means that other script names are possibly there already)

If you want a connexion on demand, you should use sudo, as jschiwal told you. As root run visudo and add this line :
<user name> ALL = NOPASSWD: /etc/rc.d/adsl start, /etc/rc.d/adsl stop
Replace <user name> with the login user name.

Then to connect as the user run :
sudo /etc/rc.d/adsl start
To disconnect run :
sudo /etc/rc.d/adsl stop

But I think the first method is better, for the scripts in /etc/rc.d are those that are used at boot time, and it is easier in Arch Linux to use the /etc/rc.conf file.

Last edited by berbae; 03-13-2007 at 10:21 AM.
 
Old 03-13-2007, 01:03 PM   #5
s26c.sayan
Member
 
Registered: Nov 2006
Location: Kolkata, India
Distribution: Arch Linux, Ubuntu Feisty, Knoppix Live CD
Posts: 37

Original Poster
Rep: Reputation: 15
Quote:
If you want a connexion on demand, you should use sudo, as jschiwal told you. As root run visudo and add this line :
<user name> ALL = NOPASSWD: /etc/rc.d/adsl start, /etc/rc.d/adsl stop
That's precisely what I have been doing.
But I'd have liked a way so that I don't have to prepend the /etc/rc.d/adsl start with sudo!!
Guess that's not possible!!
 
Old 03-13-2007, 01:25 PM   #6
berbae
Member
 
Registered: Jul 2005
Location: France
Distribution: Arch Linux
Posts: 540

Rep: Reputation: Disabled
Try to create two aliases in the ~/.bashrc file :
alias adsl_start='sudo /etc/rc.d/adsl start'
alias adsl_stop='sudo /etc/rc.d/adsl stop'

Then do a logout/login or run :
source ~/.bashrc
and connect with :
adsl_start
disconnect with :
adsl_stop
 
Old 03-13-2007, 02:24 PM   #7
s26c.sayan
Member
 
Registered: Nov 2006
Location: Kolkata, India
Distribution: Arch Linux, Ubuntu Feisty, Knoppix Live CD
Posts: 37

Original Poster
Rep: Reputation: 15
Well, I did something similar!!!

I created 2 bash script files called neton and netoff which contains ther commands sudo /etc/rc.d/adsl start' and sudo /etc/rc.d/adsl stop' respectively. Then I made them executable using chmod. Next I placed them in my PATH (put them in /usr/sbin).

Now it works!!!
 
  


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
how can connect normal user user52 Linux - Newbie 5 11-28-2006 10:10 AM
Connect To Asterisk CLI as normal user baddah Linux - Software 2 07-03-2006 02:20 AM
Root cannot connect to X while on top of normal user account Dankles Debian 4 04-26-2006 12:24 PM
Can you connect to internet as normal user without run pppd as root ? nasty_daemon Linux - Networking 2 09-13-2005 02:43 AM
adsl-start by a normal user linksocc Linux - Networking 1 09-27-2003 11:13 PM


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