View Only
last person joined: 3 days ago 

Ask questions and share experiences about Apstra, Paragon, and all things network automation.
  • 1.  ssh connection permission denied

    Posted 10-20-2022 08:06

    Hi all,

    i start with pyez and hang directly at the login to the device. i took the example from the documentation and want to connect via ssh to the device. by default pyez uses the /.ssh/ folder.

    but i always get a "PermissionError: [Errno 13] Permission denied: './ssh".

    i have also run it as admin or copied it locally somewhere else.

    any idea?


    import sys
    from getpass import getpass
    from jnpr.junos import Device
    from jnpr.junos.exception import ConnectError
    hostname = 'xxx' # input("Device hostname: ")
    # junos_username = input("Junos OS username: ")
    # junos_password = getpass("Junos OS or SSH key password: ")
    ssh_config_file = "./sshconf/"
    dev = Device(host=hostname, ssh_config=ssh_config_file)
        with Device(host=hostname, user=junos_username, passwd=junos_password) as dev:   
            print (dev.facts)
    except ConnectError as err:
        print ("Cannot connect to device: {0}".format(err))
    except Exception as err:
        print (err)


  • 2.  RE: ssh connection permission denied

    Posted 10-21-2022 06:34

    check the folder permissions as well.

    ls -ld

    if your owner permission doesn't have read, write and execute permissions change them:

    chmod 0700 /home/your_home/.ssh

    Ramon Martinez Garcia

  • 3.  RE: ssh connection permission denied

    Posted 10-24-2022 06:24
    thanks for ur reply. its a windows computer where iam doin coding. and there i have all permissions (admin rights)
    i tryed a lot but nothing work. very crazy


  • 4.  RE: ssh connection permission denied

    Posted 10-25-2022 06:46

    Make sure you have the correct public key set (generate a new RSA key pair just to be sure, and copy the public key to the switch), also you can try junos credentials from your script rather than ssh keys to verify other parts. 

    Also, just to verify the SSH keys, I would avoid the pyez script at first, just ssh the switch directly from your CLI and see if the SSH keys work or not. 

    Ramon Martinez Garcia