LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Allow normal user to connect to net using ADSL (https://www.linuxquestions.org/questions/linux-newbie-8/allow-normal-user-to-connect-to-net-using-adsl-537032/)

s26c.sayan 03-13-2007 04:57 AM

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??

lurko 03-13-2007 05:34 AM

#chmod o+x /etc/rc.d/adsl ??

there might be security implications to that though, idk.

jschiwal 03-13-2007 06:18 AM

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.

berbae 03-13-2007 09:19 AM

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.

s26c.sayan 03-13-2007 12:03 PM

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!! :(

berbae 03-13-2007 12:25 PM

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

s26c.sayan 03-13-2007 01:24 PM

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!!! :)


All times are GMT -5. The time now is 07:27 PM.