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

    Python script using pxssh not connecting when run as cron job

    Scheduled Pinned Locked Moved General pfSense Questions
    1 Posts 1 Posters 982 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
      mschuettDK
      last edited by

      Hi all,

      I'm running pfSense 2.0.1-RELEASE

      I have a python script that uses pxssh to connect to a WLAN controller. The scripts runs fine when I run it manually, but when it is run as a cron job, it fails with a permission denied error in the pxssh.connect command:

      This is the command I run in the cron job:
      echo $SHELL > /myfolder/myscript.out 2>&1; /usr/local/bin/python /myfolder/myscript.py -H 192.168.1.5 -U admin -P Mickey01 >> /myfolder/myscript.out 2>&1

      and this is the output I get:
      /bin/sh
      [ - ] Error connecting

      permission denied

      File "/myfolder/myscript.py", line 12, in connect
          s.login(host,user,password,terminal_type='ansi',original_prompt=" #",login_timeout=10,port=None,auto_prompt_reset=False)
        File "/usr/local/lib/python2.6/site-packages/pxssh.py", line 229, in login
          raise ExceptionPxssh ('permission denied')

      Can anybody help me get this script to run on a schedule?

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