Changing IP Address on OS X via PHP

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mac_newbie
Forum Newbie
Posts: 2
Joined: Thu Mar 17, 2005 1:31 pm
Location: Springfield, OR

Changing IP Address on OS X via PHP

Post by mac_newbie »

I am developing an application that requires the ability for an administrator to modify the server's IP address remotely through a web browser. The server is running OS X. I know that you can use a combination of shell_exec() and ifconfig to change the IP address, but the ifconfig command requires root access. At the command line you can use sudo along with a password, but I don't want to embed a sudo password in my script.

Does anyone have any recommendations? Is there a PHP command or script that someone has already completed to do this sort of app?

Thanks!
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

why not require the administrator to supply the password when they wish to change the IP?
mac_newbie
Forum Newbie
Posts: 2
Joined: Thu Mar 17, 2005 1:31 pm
Location: Springfield, OR

Don't want to give out the sudo password

Post by mac_newbie »

That is a good idea, however the "administator" is only the administrator of the web app. I don't want to give out the sudo password for the entire OS. Are there any other methods other then using sudo to change the IP address on OS X?

Thanks!
Post Reply