Permissions on script sudo ln -s ../init.d/start-networking S90start-networking
UbuntuThis forum is for the discussion of Ubuntu Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Permissions on script sudo ln -s ../init.d/start-networking S90start-networking
Folks,
Good morning, I am a newbie, Linux brought me a lot of challenges, which ones I am willing to try let me explain a
little bit in the past few days I was able to install my zydas adapter usb wireless I can make it work but after you restart it goes away with the ip address so next boot I got to restart it manually, I know there are a lot of of workarounds but I found one
that seems to be effective so you do not need to do a dhcp wlan0 every time you restart.
Script
1) Open up a terminal and go to /etc/init.d
Code:
cd /etc/init.d/2) make a new file called start-netorking as root
Code:
sudo vi start-networkingsubstitute vi with gedit or whatever if you wish
3) Make it a script that just starts your interfaces. Use this as an example:
Code:
#!/bin/bash
ifup wlan0
ifup eth1I have 2 interfaces called eth0 and eth1. You will probably only need the eth0 part if you only have 1 NIC.
4) change mode of script
Code:
sudo chmod 755 start-networking
5) Code:
cd ../rc2.d/7) make a link to your script in this dir
Now the ONLY problem is that when reboots it will ask you for
sudo for that script, remember I am a NEWBIE, so if asks for sudo will ask for a password and if you don't type it will skip the script "sudo ln -s ../init.d/start-networking S90start-networking" , how do I do in order to execute this script without being sudo? I know it might be risky but I found it's an efective workaround...how do I change permissions for this script and all
the scripts behind this in order to make ANY user able to run it at the boot time?
You need to specify which distro and version you're using.
For RedHat, Fedora Coreand or Debian you would NOT put sudo into an init script because init scripts run as root anyway.
Hi,
Thanks for the response, I am using Ubuntu 6.10, in that case Debian rules should apply...
wondering why is not working, say you have any ideas?
I heard I can add it at the rc.local which is the set of scripts from the boot proces..but at this point no idea where to start
The way init scripts work (Debian and RedHat/Fedora):
You create the script in /etc/init.d.
You create a symbolic link in /etc/rc?.d back to the file in /etc/init.d. The ? is the run level in which you want the script to run. (That is to say there are multiple directories, rc1.d, rc2.d, rcS.d etc...)
The file in /etc/init.d should have a base name (e.g. start-networking) whereas the files in /etc/rc?.d would have a start name (e.g. S90start-networking) and/or a stop (kill) name (e.g. K10start-networking).
So creating a file like /etc/init.d/S90start-networking wouldn't work because there is no link in the run level directories.
The syntax of init scripts like this requires you to at least provide a start and a stop section. You should look at what you currently have in /etc/init.d then find the relevant links in /etc/rc?.d directories to get a good idea of how to set this up.
The main point in my earlier email was init scripts run as root so should not need you to include a "sudo" in them.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.