Following the recent Raspbian update, I have uploaded an SSH file to my server to be downloaded and copied into the /boot/ directory. This SSH file is a simple txt file, containing only
ssh, and is intended for others to download and use whenever they install Raspbian for the first time (as per the instructions here).
When testing the SSH file, I get different results. The test procedure includes formatting the SD card, copying Raspbian onto it, copying the downloaded SSH file to the /boot/ directory, booting the Raspberry Pi and logging in via SSH.
Sometimes logging in via SSH works, other times I get the error message
Connection closed by <ipv6 address> port 22.
The SSH file gets deleted when the connection is closed and sometimes the SSH file doesn't get deleted even after the connection was successful.
Why does it sometimes log in successfully and at other times the connection closes? Is there a solution to the error?