I am writing a simple DHCP server application that gets ip from a server at boot up ! i wrote a shell script to run the java program that obtains ip from server on another machine...
The problem is when i have obtained the ip i store it in a file ! using awk i retrieve the ip and i'm trying to execute the command ifconfig eth0 x.x.x.x !! as it needs admin privileges it is currently not working.. i need to figure out a way such that at boot up without asking the password the program should run.... please help me!!!

6 Years
Discussion Span
Last Post by JeoSaurus

Look at putting the code you want executed in /etc/init.d/ . That is the traditional location of startup scripts and they are run as root.


/etc/rc.local is a good place to put simple scripts that you want executed at boot-time. Lines in rc.local are executed as root (unless specified otherwise) and after all the other startup scripts have run.


Not "corrected"! Enhanced! :)

You CAN create an init script and drop it into /etc/init.d
But if it's just a script that you want to run once, at boot time, /etc/rc.local is the super-simple way to do it.

I suspect the OP might have issues with this though, if he doesn't have root privileges...

dinesh17: Do you have 'root' or 'sudo' access on the system in question? You mention having trouble running the script manually. You *should* be able to run it from the command line as root, or with 'sudo'.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.