# GvmError: Remove closed the connection

**URL:** <https://forum.greenbone.net/t/gvmerror-remove-closed-the-connection/8794>\
**Category:** Open Scanner Protocol (OSP)\
**Created:** [April 1, 2021, 11:18am UTC](https://forum.greenbone.net/t/gvmerror-remove-closed-the-connection/8794 "2021-04-01T11:18:22Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![micycle](https://forum.greenbone.net/letter_avatar/micycle/32/6_449c533f586939b6e5f246632a46421f.png) [@micycle](https://forum.greenbone.net/u/micycle)\
**Post date:** [April 1, 2021, 11:18am UTC](https://forum.greenbone.net/t/gvmerror-remove-closed-the-connection/8794/1 "2021-04-01T11:18:22Z")

</div>

I am trying to run a simple script using the python-gvm library from a windows machine to connect to my Breenbone Security Manager on another machine.  
The script goes like this:

```
from gvm.connections import SSHConnection
from gvm.protocols.gmp import Gmp
from gvm.transforms import EtreeTransform

connection = SSHConnection(hostname=<HOSTNAME>, username=<ADMIN>, password=<PASSWORD>)
transform = EtreeTransform()

with Gmp(connection, transform=transform) as gmp:
    # Retrieve GMP version supported by the remote daemon
    version = gmp.get_version()

```

But I keep getting the same error, which I can’t understand why is popping up:

```
GvmError Traceback (most recent call last)
<ipython-input-21-1e67790e5056> in <module>
----> 1 with Gmp(connection=connection) as gmp:
      2 pretty_print(gmp.get_version())
      3
      4

c:\users\user\appdata\local\programs\python\python38-32\lib\site-packages\gvm\protocols\gmp.py in __enter__ (self)
    122
    123 def __enter__ (self):
--> 124 gmp = self.determine_supported_gmp()
    125
    126 gmp.connect()

c:\users\user\appdata\local\programs\python\python38-32\lib\site-packages\gvm\protocols\gmp.py in determine_supported_gmp(self)
    101 corresponding Gmp class instance
    102 """
--> 103 version = self.determine_remote_gmp_version()
    104 major_version = int(version.split('.')[0])
    105 if major_version == 7:

c:\users\user\appdata\local\programs\python\python38-32\lib\site-packages\gvm\protocols\gmp.py in determine_remote_gmp_version(self)
     85 """Determine the supported GMP version of the remote daemon"""
     86 self.connect()
---> 87 resp = self._send_xml_command(XmlCommand("get_version"))
     88 self.disconnect()
     89

c:\users\user\appdata\local\programs\python\python38-32\lib\site-packages\gvm\protocols\base.py in _send_xml_command(self, xmlcmd)
     84 xmlcmd (gvm.xml.XmlCommand): XmlCommand instance to send
     85 """
---> 86 return self.send_command(xmlcmd.to_string())
     87
     88 def is_connected(self) -> bool:

c:\users\user\appdata\local\programs\python\python38-32\lib\site-packages\gvm\protocols\base.py in send_command(self, cmd)
    138 except Exception as e:
    139 self.disconnect()
--> 140 raise e
    141
    142 return self._transform(response)

c:\users\user\appdata\local\programs\python\python38-32\lib\site-packages\gvm\protocols\base.py in send_command(self, cmd)
    135 try:
    136 self._send(cmd)
--> 137 response = self._read()
    138 except Exception as e:
    139 self.disconnect()

c:\users\user\appdata\local\programs\python\python38-32\lib\site-packages\gvm\protocols\base.py in _read(self)
     61 str: Response from server.
     62 """
---> 63 return self._connection.read()
     64
     65 def _send(self, data):

c:\users\user\appdata\local\programs\python\python38-32\lib\site-packages\gvm\connections.py in read(self)
    139 if not data:
    140 # Connection was closed by server
--> 141 raise GvmError("Remote closed the connection")
    142
    143 self._feed_xml(data)

```

GvmError: Remote closed the connection

What could cause this issue?

### GVM versions

Wasn’t sure to which each of those fields refer to, but the version of python-gvm I downloaded from pip was 21.1.3 and the version of the Greenbone OS is 20.08.7  
I hope this is OK.

### Environment

The Environment that runs the script is a windows 10 and the Greenbone Security Manager runs on a Greenbone OS 20.08.7

---

<div class="post-metadata">

**Author:** ![bricks](https://forum.greenbone.net/user_avatar/forum.greenbone.net/bricks/32/46_2.png) [@bricks](https://forum.greenbone.net/u/bricks)\
**Post date:** [April 1, 2021, 11:36am UTC](https://forum.greenbone.net/t/gvmerror-remove-closed-the-connection/8794/2 "2021-04-01T11:36:09Z")

</div>

Hi, it would be easier to use a gmp script and run it via gvm-tools. gvm-tools already provides and implements the correct connection handling. If you have a GSM just use the defaults to create the SSHConnection. Don’t pass any parameters to the constructor of that class besides the hostname.

---

<div class="post-metadata">

**Author:** ![micycle](https://forum.greenbone.net/letter_avatar/micycle/32/6_449c533f586939b6e5f246632a46421f.png) [@micycle](https://forum.greenbone.net/u/micycle)\
**Post date:** [April 1, 2021, 12:30pm UTC](https://forum.greenbone.net/t/gvmerror-remove-closed-the-connection/8794/3 "2021-04-01T12:30:58Z")

</div>

I gave it a shot, writing the following script:

```
def main(gmp, args):
    version = gmp.get_version()

if __name__ == ' __gmp__':
    main(gmp, args) 

```

and then running:  
gvm-script ssh --hostname C:\Users\user\AppData\Roaming\JetBrains\PyCharmCE2020.2\scratches\greenbone.py

But what I get is:  
SSH Connection failed

---

<div class="post-metadata">

**Author:** ![bricks](https://forum.greenbone.net/user_avatar/forum.greenbone.net/bricks/32/46_2.png) [@bricks](https://forum.greenbone.net/u/bricks)\
**Post date:** [April 1, 2021, 2:36pm UTC](https://forum.greenbone.net/t/gvmerror-remove-closed-the-connection/8794/4 "2021-04-01T14:36:10Z")

</div>

Did you activate GMP in the GOS menu?

[https://docs.greenbone.net/GSM-Manual/gos-20.08/en/managing-gos.html#configuring-the-greenbone-management-protocol-gmp](https://docs.greenbone.net/GSM-Manual/gos-20.08/en/managing-gos.html#configuring-the-greenbone-management-protocol-gmp)

The SSH access is **not** available in the GSM Trial.

---

<div class="post-metadata">

**Author:** ![micycle](https://forum.greenbone.net/letter_avatar/micycle/32/6_449c533f586939b6e5f246632a46421f.png) [@micycle](https://forum.greenbone.net/u/micycle)\
**Post date:** [April 1, 2021, 2:44pm UTC](https://forum.greenbone.net/t/gvmerror-remove-closed-the-connection/8794/5 "2021-04-01T14:44:25Z")

</div>

I see, I am using the GSM Trial, if so, is there another way to send automated commands to the GSM in the free trial?

---

<div class="post-metadata">

**Author:** ![bricks](https://forum.greenbone.net/user_avatar/forum.greenbone.net/bricks/32/46_2.png) [@bricks](https://forum.greenbone.net/u/bricks)\
**Post date:** [April 1, 2021, 3:20pm UTC](https://forum.greenbone.net/t/gvmerror-remove-closed-the-connection/8794/6 "2021-04-01T15:20:44Z")

</div>

No. You can only run GMP scripts on the GSM Trial directly.

---

<div class="post-metadata">

**Author:** ![cfi](https://forum.greenbone.net/letter_avatar/cfi/32/6_449c533f586939b6e5f246632a46421f.png) [@cfi](https://forum.greenbone.net/u/cfi)\
**Post date:** [November 23, 2023, 10:19am UTC](https://forum.greenbone.net/t/gvmerror-remove-closed-the-connection/8794/8 "2023-11-23T10:19:24Z")

</div>

Hello @jcordoba and welcome to this community forums.

Please try to use the English language in this forums for any questions / support / help. As your question seems to be also about the Docker Containers i would suggest to look into [Community Containers - Greenbone Community Forum](https://forum.greenbone.net/c/community-containers/40) for possible existing threads or create a new topic there rather then asking in a 3 year old and already marked as “solved” thread.

---

<div class="post-metadata">

**Author:** ![bricks](https://forum.greenbone.net/user_avatar/forum.greenbone.net/bricks/32/46_2.png) [@bricks](https://forum.greenbone.net/u/bricks)\
**Post date:** [November 27, 2023, 7:07am UTC](https://forum.greenbone.net/t/gvmerror-remove-closed-the-connection/8794/9 "2023-11-27T07:07:15Z")

</div>

Split this topic on November 27, 2023, 7:07am UTC

A post was split to a new topic: [Remote connection to container](https://forum.greenbone.net/t/remote-connection-to-container/16296)

---

<div class="post-metadata">

**Author:** ![system](https://forum.greenbone.net/uploads/default/original/2X/4/4660e797edfaea797a8c9965246072ea26732804.png) [@system](https://forum.greenbone.net/u/system)\
**Post date:** [April 7, 2025, 10:09am UTC](https://forum.greenbone.net/t/gvmerror-remove-closed-the-connection/8794/10 "2025-04-07T10:09:44Z")

</div>

Closed on April 7, 2025, 10:09am UTC


