Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    Authorized_keys file for root disappears?

    Scheduled Pinned Locked Moved Virtualization
    3 Posts 2 Posters 3.4k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • R
      rdlugosz
      last edited by

      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?

      1 Reply Last reply Reply Quote 0
      • jimpJ
        jimp Rebel Alliance Developer Netgate
        last edited by

        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.

        Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

        Need help fast? Netgate Global Support!

        Do not Chat/PM for help!

        1 Reply Last reply Reply Quote 0
        • R
          rdlugosz
          last edited by

          @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.

          1 Reply Last reply Reply Quote 0
          • First post
            Last post
          Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.