Как исправить ошибку connection closed by server

Redis config file:
redis_conf.txt

Here is an exception:
exception

I run latest version of redis in container:

redis:
image: redis:latest
container_name: redis
ports:
— 6379:6379
volumes:
— ./config/redis.conf:/redis.conf
command: [ «redis-server», «/redis.conf» ]

The application is written in Python ver 3.9

`import redis

pool = redis.ConnectionPool(host=’localhost’, port=6379, db=0)
r = redis.Redis(connection_pool=pool)

r.set(‘foo’, ‘bar’)
value = r.get(‘foo’)
print(value)`

As you see it is very basic. I had more complicated code that I tried to run at the beginning where I communicated with redis in multithread. Later this code caused a problem so that I am not able even to start with the above simple code no matter what I do: restart the computer, restart container, reinstall redis module. nothing helps
I send commands in redis cli and it works. But python throws an exception:

Please help me stay with redis!

Hi ! I have been uploading several ~200 Mo files (one at a time), and each time, after about 5 minutes, I get this «Error: Connection closed by server», although the file keeps uplading normally !?!

To check, I right-click into the lower window of the «Remote site» and chose REFRESH, which seem to re-open the connection (!?!) and shows that the upload effectively didn’t stop nor slowered down !

Here’s what I get after hitting RELOAD:

Error: Connection closed by server
Status: Resolving address of upload.360cities.net
Status: Connecting to 50.17.223.50:21…
Status: Connection established, waiting for welcome message…
Response: 220 Welcome to the 360 Cities FTP service.
Command: USER ftp_user_5952
Response: 331 Please specify the password.
Command: PASS *********
Response: 230 Login successful.
Status: Server does not support non-ASCII characters.
Status: Connected
Status: Retrieving directory listing…
Command: CWD /
Response: 250 Directory successfully changed.
Command: TYPE I
Response: 200 Switching to Binary mode.
Command: PASV
Response: 227 Entering Passive Mode (50,17,223,50,4,5).
Command: LIST -a
Response: 150 Here comes the directory listing.
Response: 226 Directory send OK.
Status: Directory listing successful

….and a few minutes after:
Error: Connection closed by server again !!!

What can I do to avoid getting this error message ?

Other question: I remember that, some times ago, when launching Fillezilla, I only had to click on QUICKCONNECT and chose in a list the address where I wanted to upload ! Now, this window is allways empty and the only way to find the address is by clicking on FILE > SITE MANAGER ! How can I have the addresses back in QUICKCONNECT ?

Thanks in advance for any help or tips !

J-P.

I am trying to ssh login to my remote server. But whenever i try to login through terminal using ssh command:

  ssh root@{ip_address}

I get error:

 Connection closed by {ip_address}

I checked hosts deny and hosts allow, there is nothing in the file. I am not getting why it happening?

It happened when i changed my workstation and key got changed. When i tried ssh login, it asked to add key and i entered yes and then it closed the connection.

Is there any way to get connected with ssh again?

Your help is appreciated.

Thank you.

Edit:

Output of ssh -v -v -v -v root@{ip_address} is

OpenSSH_5.9p1 Debian-5ubuntu1.1, OpenSSL 1.0.1 14 Mar 2012
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to {ip_address} [{ip_address}] port 22.
debug1: Connection established.
debug3: Incorrect RSA1 identifier
debug3: Could not load "/home/mona/.ssh/id_rsa" as a RSA1 public key
debug1: identity file /home/mona/.ssh/id_rsa type 1
debug1: Checking blacklist file /usr/share/ssh/blacklist.RSA-2048
debug1: Checking blacklist file /etc/ssh/blacklist.RSA-2048
debug1: identity file /home/mona/.ssh/id_rsa-cert type -1
debug1: identity file /home/mona/.ssh/id_dsa type -1
debug1: identity file /home/mona/.ssh/id_dsa-cert type -1
debug1: identity file /home/mona/.ssh/id_ecdsa type -1
debug1: identity file /home/mona/.ssh/id_ecdsa-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.9p1 Debian-5ubuntu1.1
debug1: match: OpenSSH_5.9p1 Debian-5ubuntu1.1 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.9p1 Debian-5ubuntu1.1
debug2: fd 3 setting O_NONBLOCK
debug3: load_hostkeys: loading entries for host "{ip_address}" from file "/home/mona/.ssh/known_hosts"
debug3: load_hostkeys: loaded 0 keys
debug1: SSH2_MSG_KEXINIT sent
Connection closed by 151.236.220.15

Following Fred’s point in the comments (and actually reading the error message), I was incorrect and ssh was connecting. I will leave my original response at the bottom and additionally answer the question of not being able to connect to a running ssh.

Another good way to diagnose ssh issues when the sshd server refuses connections, and if the OP is correct nothing is getting logged in auth.log or syslog, is to run it on a separate port with debugging enabled (I’ve picked the arbitrary port of 44).

/full/path/to/sshd -p 44 -d 

You can then connect with your ssh client and get further debugging of the issue:

ssh -p 44 root@x.x.x.x

Root (as Fred pointed out in his answer) is a user that can potentially be restricted
via the ssh option PermitRootLogin option in your sshd_config. Also the types of authentication methods used by your sshd_config can further restrict how you can access
your host:

RSAAuthentication
PubkeyAuthentication
RhostsRSAAuthentication
HostbasedAuthentication
ChallengeResponseAuthentication
PasswordAuthentication
KerberosAuthentication
GSSAPIAuthentication

Look at the man page for sshd_config (man 5 sshd_config) for more information on those options. Usually most sshds have RSAAuthentication, PubkeyAuthentication and sometimes PasswordAuthentication. RSAAuthentication is specific to Protocol 1 and most hosts use Protocol 2 which uses PubkeyAuthentication. Both rely on root having a key file (usually found in /root/.ssh/authorized_keys), but this location can be overridden by the AuthorizedKeysFile option. It looks like PasswordAuthentication is not enabled on your sshd.

For RSA and Pubkey authentication you need a keypair. Which you have generated and they live on your client machine in /home/mona/.ssh/id_rsa and /home/mona/.ssh/id_rsa.pub. The public half of these two files (the key contained in /home/mona/.ssh/id_rsa.pub) you would need to put in root’s authorized_key file mentioned above.

Original Answer, referring to a failure to connect remotely to the sshd process

That looks like either TCPWrappers or a firewall closing the initial connection.

Check your auth.log or syslog files in /var/log as these may provide some clues as to which is blocking the connection.

TCPwrappers is usually implemented via a /etc/hosts.allow file and on some unixes an additional or just the /etc/hosts.deny file (i.e without a hosts.allow file).

Entries are usually of the form:

<service> : <access list> : <allow|deny>

OR

<service> : <access list>

depending on the type of tcp wrapper being used. The format of these files can usually be found with the hosts_access man page man 5 hosts_access. You may have to add an entry to allow your remote IP access.

sshd : my.ip.address.here : allow

Most distributions with a Linux kernel tend to use iptables as the main firewall, though some use ipchains. (I know FreeBSD uses ipfw which is ported from NetBSD). You service provider may also have a firewall, or router with a firewall in front of your service which is blocking these requests. As to which firewall your hosts uses will need some investigation.

iptables firewall rules can be listed via the iptables -nvL command (which must be ran as root, or via sudo). the INPUT chain is the ruleset used to allow/disallow incoming connections your host. You may have to add a rule to allow SSH connections inbound:

iptables -I INPUT -p tcp --dport 22 -j ACCEPT -m comment --comment "Allow SSH connections from all hosts"

You may want to make it only allow connections from a specific IP:

iptables -I INPUT -s 10.10.10.10 -p tcp --dport 22 -j ACCEPT -m comment --comment "Allow SSH connections from the 10.10.10.10 host"

If your service provider blocks port 22, then you will probably need to put the service on a different port (port 2222 is quite popular) via the Port option in your sshd_config file (which usually lives in /etc/ssh).

Через секунд 40 происходит разрыв соединения и выводит ошибку

(node:10832) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
events.js:183
      throw er; // Unhandled 'error' event
      ^
Error: Connection lost: The server closed the connection.
    at Protocol.end (C:UserssskatDesktopprojectnode_modulesmysqllibprotocolProtocol.js:113:13)
    at Socket.<anonymous> (C:UserssskatDesktopprojectnode_modulesmysqllibConnection.js:109:28)
    at emitNone (events.js:111:20)
    at Socket.emit (events.js:208:7)
    at endReadableNT (_stream_readable.js:1055:12)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)

Вот сам файл

const
  mysql = require('mysql'),
  { error } = require('handy-log'),
  { MYSQL_HOST, MYSQL_USER, MYSQL_PASSWORD, MYSQL_DATABASE } = process.env
const db = mysql.createConnection({
  host: MYSQL_HOST,
  user: MYSQL_USER,
  password: MYSQL_PASSWORD,
  database: MYSQL_DATABASE,
  charset: 'utf8mb4'
})
db.connect(err => {
  if(err){
    error(err.message)
  }
})
module.exports = db

Понравилась статья? Поделить с друзьями:
  • Как исправить ошибку component mscomctl ocx
  • Как исправить ошибку communication error
  • Как исправить ошибку command line
  • Как исправить ошибку com google process gapps произошла ошибка
  • Как исправить ошибку com google process gapps остановлен