route default gw during startup

Nov 22, 2005 6 Replies

How do I run route during startup, even when it logs in as a user? Currently it says "SIOCADDRT: Operation not permitted" unless I log in as root.



Using MontaVista Linux on an embedded processor.



Make route setuid root. But you knew that, didn't you?

Um, no I didn't, I'm a newbie. But anyway, setuid() is a programming command, now that I've googled it.

formatting link
says I should use chmod & chown to set the "execute as a certain" uid. Now that would be useful to know. Unless I knew about setuid I would not have been able to find this info. That's why people hate Linux.

So how can I do this securely? The embedded processor (naturally) uses "busybox" (route links to "busybox"). Surely I shouldn't "busybox setuid root" (not that that command works anyway!)

Can I put the route command in rc.local and then "chmod 4777" /etc/rc.d/rc.local instead? Is this safe?

Hmm may be 4755 instead of 4777. Anyway I worked it out. I have to put the route command AFTER ifconfig. Obviously.

*doh*

Normally that's the best way to do things, if the routes are static.

As for BusyBox - I'm not sure if you can have individual commands run setuid. That would be a feature of BusyBox - if it exists.

For non-static routes, dhcpd or other config manager running as root usually takes care of the routes.

Can't you just put the route command in your .../init.d/network file?

Being an embedded system, it really doesn't have a ../init.d/network file. Aaaarggghh!!! Anyway it seems to be all working now. I guess "ifconfig" deletes the routing tables, which is fair enough.

Thanks for all the help guys! Now I know how to accidently introduce security holes in the system using chmod! =)

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required