Strovent SystemsSign in
Reference

sshd log "Received disconnect from ... 11: Bye Bye [preauth]": what it means

In an sshd log, Received disconnect ... 11 [preauth] means a client hung up before logging in. Code 11 is a normal close; the text after it is the client's.

sshd[2041]: Received disconnect from 203.0.113.7 port 51734:11: Bye Bye [preauth]
sshd[2041]: Disconnected from authenticating user root 203.0.113.7 port 51734 [preauth]

These lines come from the SSH server's log, not from a client screen. A client connected, then sent the SSH "disconnect" message and left before it finished logging in. Nobody logged in on this connection.

Reading the line

  • 203.0.113.7 port 51734 is the client's address and the source port it used. The port changes on every connection and says nothing about the server's port.
  • 11 is the reason code from the SSH standard (RFC 4253, section 11.1). 11 is SSH_DISCONNECT_BY_APPLICATION: the client is closing on purpose. OpenSSH logs code 11 at the normal INFO level and other codes at ERROR level.
  • Bye Bye is free text the client chose. It is not a server message. The OpenSSH client sends disconnected by user, so Bye Bye means some other SSH client, library or tool made the connection.
  • [preauth] marks messages from the part of sshd that handles a connection before authentication succeeds. It means the client left before it was logged in.

The second line is OpenSSH's summary when the connection ends. The words before the address show how far the client got:

  • authenticating user root: the client asked to log in as root, an account that exists.
  • invalid user admin: the client asked for an account that does not exist on this server.
  • No user named: the client left before sending a user name at all.

Common patterns

  • The same address tries several user names, each ending in [preauth]. This is automated password guessing or scanning. Hosts with SSH open to the internet see it all day. Look for lines such as Failed password or Invalid user with the same address to confirm.
  • A monitoring tool or load balancer connects every few seconds and leaves. A health check only needs to see that SSH answers, so it disconnects before logging in. The source address is your own monitoring system.
  • A user cancels at the password or host key prompt. An abandoned login also ends in [preauth], as a Received disconnect line with the client's own text or as a Connection closed line.

Other lines from the same family

  • Connection closed by 203.0.113.7 port 51734 [preauth]: the client closed the TCP connection without sending the SSH disconnect message.
  • Connection reset by 203.0.113.7 port 51734 [preauth]: the connection was reset, by the client or by something in the network.
  • Disconnected from user user1 203.0.113.7 port 51734: a session that did log in has ended. It normally has no [preauth] tag because authentication had succeeded.

Should you do anything?

The line itself shows a refused or abandoned login, not a break-in. If the log shows guessing, the usual steps on an OpenSSH server are:

  • Allow keys only, with PasswordAuthentication no and KbdInteractiveAuthentication no in sshd_config. See Authorized keys and permissions.
  • Do not allow direct root logins with passwords: PermitRootLogin prohibit-password (the default) or no.
  • OpenSSH 9.8 and later can block addresses that keep failing to log in for a while, with PerSourcePenalties, which is on by default. It can also make legitimate clients see "Connection closed"; see SSH banner exchange errors, "Connection closed" and "timed out during banner exchange".
  • Limit who can reach port 22 with a firewall or VPN where you can.

Disconnect reason codes

The full list from RFC 4253, section 11.1. Clients show the same codes when the server disconnects them, for example Received disconnect from 192.0.2.10 port 22:2: Too many authentication failures.

  • 1: host not allowed to connect
  • 2: protocol error
  • 3: key exchange failed
  • 4: reserved
  • 5: MAC error
  • 6: compression error
  • 7: service not available
  • 8: protocol version not supported
  • 9: host key not verifiable
  • 10: connection lost
  • 11: by application (normal close)
  • 12: too many connections
  • 13: authentication cancelled by user
  • 14: no more authentication methods available
  • 15: illegal user name

Sources

Spotted a mistake? Email [email protected].