Authorized_keys file for root disappears?



  • I'm in the process of setting up a startup/shutdown script for pfSense running in a VirtualBox VM.  In order to shut it down cleanly, I'd like to issue a shutdown command… the easiest way to do this seems to be:

    • add a /root/.ssh/authorized_keys file
    • disable the .profile in /root so that the command menu doesn't prevent a shell prompt on ssh
    • in my shutdown script on the host, issue a "ssh root@192.168.1.1 'shutdown -p now'"

    Works great - ONCE.  Then, upon reboot it appears that the root password gets reset AND the authorized_keys file disappears!  WTF is going on with that?

    I then tried creating a new user to do this with... trouble there is that this user isn't allowed to issue the shutdown command & there is no sudo available.  Any ideas?


  • Rebel Alliance Developer Netgate

    Add the key to the admin user in the GUI. The admin user in the GUI is the root user (and admin…) in the shell. The key from the admin user in the GUI is written out at boot time, which is why your manual edits are being wiped out.



  • @jimp:

    Add the key to the admin user in the GUI. The admin user in the GUI is the root user (and admin…) in the shell. The key from the admin user in the GUI is written out at boot time, which is why your manual edits are being wiped out.

    Ah! Thanks for this tip… the mystery has been solved!

    FWIW I've since moved from using pf in a VM to a dedicated thin client box.  Greatly improved situation since now I don't lose internet simply because I need to bounce the server.  Was nice for testing though.


Log in to reply