Use Paramiko to access ERPNext in Localhost

Hi Everyone!

As the title implies, I’m trying to create a python script that uses the Paramiko Python Library to automate a few things eg. creating a site and installing the ERPNext App on my localhost.

The problem is, whenever I run the script, it returns an error saying the ssh connection can’t access

Anyone know how to do this? :slight_smile:

Please can you share the output with the error.

To my knowledge port 8000 is already used for the redis socket listener?

frappe@erpnext:~/frappe-bench$ find logs *.log | xargs grep :8000
logs/web.error.log:[2017-01-14 10:46:29 +0000] [1534] [INFO] Listening at: (1534)
logs/web.error.log: bind: [‘’]
logs/web.error.log:[2017-01-14 22:29:00 +0000] [2409] [INFO] Listening at: (2409)
logs/web.error.log: bind: [‘’]
logs/web.error.log:[2017-01-14 22:32:01 +0000] [1545] [INFO] Listening at: (1545)
logs/web.error.log:[2017-01-15 14:39:34 +0000] [2894] [INFO] Listening at: (2894)

Have you output from the script to share that lists the error?

Hi @clarkej and thanks for the reply!

Tried Paramiko (and the exact same code) on a remote IP and it works fine. But connecting to localhost or / gives out a socket error:
cannot connect to port 22 on [the ip address]
If I do specify the port, it displays the same error except that port 22 becomes port 8000/8001.

This is probably because of permissions, or my local setup. I’m not that good at networking/server setups. Anyway, I’ve currently resigned myself to working with a remote virtual machine. But thank you for your support.


In my local these connect as expected:

frappe@erpnext:~/frappe-bench$ ssh frappe@localhost
frappe@erpnext:~/frappe-bench$ ssh -P22 frappe@localhost

frappe@erpnext:~/frappe-bench$ nc -vv localhost 22
Connection to localhost 22 port [tcp/ssh] succeeded!
SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.6

I believe ssh connects first on port 22 but then moves to another port.

So if these checks above don’t behave as expected then you have say some port forward config in your local or that occurs in paramiko?

I’m not using the production environment, or a vm, at the moment. I have frappe and erpnext installed on my laptop. So I guess that’s the reason why the connection keeps closing.

Thanks @clarkej!