route default gw during startup

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.

Reply to
anvilsoup
Loading thread data ...

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

Reply to
Bryan Hackney

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?

Reply to
anvilsoup

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

*doh*
Reply to
anvilsoup

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.

Reply to
Bryan Hackney

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

Reply to
FLY135

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! =)

Reply to
anvilsoup

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.