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?? |
#chmod o+x /etc/rc.d/adsl ??
there might be security implications to that though, idk. |
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.
|
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. |
Quote:
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!! :( |
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 |
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. |