Add DHCp reservations by script

  • Hello,

    I have a script for creating Linux containers. I want to make it add DHCP reservations to pfSense for the hostname and IP number that the new container is given. After a lot of searching on the Internet and reading documentation, I've realized there are multiple ways. I've come closest to my goal with the following method.

    Create new user with administrator privileges. Add user to wheel group. Let the script ssh onto the pfSense machine and modify the DHCP reservation part of config.xml. Restart the DHCP service using "pfSsh.php playback restartdhcpd". However, this gives an error message, saying no processes belonging to me were found.

    If I log in as root I get the menu, instead of a prompt. That is why I am using a different account. I was assuming when going through the pfSsh.php script it would only matter whether the user belonged to the admin group, but that is obviously not the case.

    I'm sure the bright people here have a suggestion for how to do what I'm looking for, possibly even in a completely different way. Suggestions are very welcome!

    While I'm posting, I'd also like to ask if changes to the home directories are volatile. I have put my public key on the pfSense box using the ssh-copy-id command, but after a reboot of my pfSense machine it has disappeared. Must keys be added through the web interface?

    Many thanks in advance!