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

    expect script not working as expected

    Scheduled Pinned Locked Moved Development
    7 Posts 3 Posters 1.3k 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.
    • M
      mephmanx
      last edited by mephmanx

      I am trying to use an expect script against a pfsense 2.6 vm running on qemu but I am seeing strange behavior when trying to use it.

      expect script (for demo purposes)

      #!/usr/bin/expect
      set timeout -1;
      spawn telnet localhost 4568
      send "\n"
      expect -ex "Enter an option:"
      send "8\n"
      expect "option:"
      send "8\r"
      expect eof
      expect "root"
      send "./pf-init-2.sh\r"
      expect "/root"
      

      But when it is run, it hangs at the below prompt:Screenshot 2023-01-24 at 10.26.46 AM.png

      Adding debug output:
      Screenshot 2023-01-24 at 11.03.35 AM.png

      V 1 Reply Last reply Reply Quote 0
      • V
        viragomann @mephmanx
        last edited by

        @mephmanx
        Why don't you use SSH??

        M 2 Replies Last reply Reply Quote 0
        • M
          mephmanx @viragomann
          last edited by mephmanx

          @viragomann can i change the ssh port? i am running this through an ssh session so ssh to localhost 22 logs in to the local system, not the pfsense vm.

          R 1 Reply Last reply Reply Quote 0
          • R
            rcoleman-netgate Netgate @mephmanx
            last edited by

            @mephmanx said in expect script not working as expected:

            can i change the ssh port?

            https://docs.netgate.com/pfsense/en/latest/config/advanced-admin.html#ssh-port

            A search header in our docs when you search "ssh port"

            Ryan
            Repeat, after me: MESH IS THE DEVIL! MESH IS THE DEVIL!
            Requesting firmware for your Netgate device? https://go.netgate.com
            Switching: Mikrotik, Netgear, Extreme
            Wireless: Aruba, Ubiquiti

            M 1 Reply Last reply Reply Quote 0
            • M
              mephmanx @rcoleman-netgate
              last edited by

              @rcoleman-netgate what would be the value in the xml? i dont have access to the gui in this use case.

              1 Reply Last reply Reply Quote 0
              • M
                mephmanx @viragomann
                last edited by

                @viragomann it also appears like I have no access to the networks either...only telnet. i havent hooked up the virtual ports to the host...

                V 1 Reply Last reply Reply Quote 0
                • V
                  viragomann @mephmanx
                  last edited by

                  @mephmanx
                  Can you edit and re-import the config?

                  If so, there is an <ssh> section within <system>.
                  You can add a port line there:

                  <port></port>
                  
                  1 Reply Last reply Reply Quote 0
                  • jimpJ jimp moved this topic from Problems Installing or Upgrading pfSense Software on
                  • First post
                    Last post
                  Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.