LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu
User Name
Password
Ubuntu This forum is for the discussion of Ubuntu Linux.

Notices


Reply
  Search this Thread
Old 04-02-2007, 07:35 AM   #1
cnolasco
LQ Newbie
 
Registered: Apr 2006
Posts: 3

Rep: Reputation: 0
Wink 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


Code:
sudo ln -s ../init.d/start-networking S90start-networking


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?


Thanks!

Last edited by cnolasco; 04-02-2007 at 07:38 AM.
 
Old 04-02-2007, 01:16 PM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
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.
 
Old 04-03-2007, 07:52 AM   #3
cnolasco
LQ Newbie
 
Registered: Apr 2006
Posts: 3

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by jlightner
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

thanks.
 
Old 04-03-2007, 08:27 AM   #4
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
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.
 
  


Reply



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
In what init file are networking interface info called from jchance Mandriva 1 01-20-2007 08:12 AM
howto start vpnclient with php script and sudo ? cccc Programming 1 01-12-2004 11:46 AM
Explanations for Networking and users permissions in Red Hat 9 marinovedder Linux - Networking 1 01-08-2004 06:44 PM

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

All times are GMT -5. The time now is 09:47 PM.

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
Open Source Consulting | Domain Registration