Skip to content

Instantly share code, notes, and snippets.

@githubcom13
Created June 14, 2020 21:41
Show Gist options
  • Save githubcom13/d0e9a7633debd3d9d0b8ffb48a14fff9 to your computer and use it in GitHub Desktop.
Save githubcom13/d0e9a7633debd3d9d0b8ffb48a14fff9 to your computer and use it in GitHub Desktop.
After a reboot, i can no longer connect to my Debian 10 server in SSH.
I receive the following error message: Socket is closed: Socket closed by remote peer
The identifier/password are correct (i don't use a key), I tried with Putty, ZenTermLite and Filezilla clients in sFTP mode.
# log filezilla
Status: Connecting to xx.xx.xx.xx...
Response: fzSftp started, protocol_version=9
Command: open "root@xx.xx.xx.xx" 22
Error: FATAL ERROR: Remote side unexpectedly closed network connection
Error: Could not connect to server
Status: Waiting to retry...
# log ZenTermLite
Socket is closed: Socket closed by remote peer
I do not have access to the server log since the connection is impossible.
Have you ever had a problem? Any idea how to fix it?
Thanks, regards.
**RESOLU**
1. I restart in rescue mode
2. [Mount the partition][1] containing the data
3. Consult the `/var/log/syslog` file which indicates:
.
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: UNPROTECTED PRIVATE KEY FILE! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0755 for '/etc/ssh/ssh_host_ed25519_key' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
Error loading host key "/etc/ssh/ssh_host_ed25519_key": bad permissions
Could not load host key: /etc/ssh/ssh_host_ed25519_key
Then I set the folder permissions `/etc/.ssh/` like this:
chmod 700 ~/.ssh
chmod 644 ~/.ssh/authorized_keys
chmod 644 ~/.ssh/known_hosts
chmod 644 ~/.ssh/config
chmod 600 ~/.ssh/id_rsa
chmod 644 ~/.ssh/id_rsa.pub
chmod 600 ~/.ssh/github_rsa
chmod 644 ~/.ssh/github_rsa.pub
chmod 600 ~/.ssh/mozilla_rsa
chmod 644 ~/.ssh/mozilla_rsa.pub
chmod 600 ~/.ssh_host_ed25519_key
chmod 644 ~/.ssh_host_ed25519_key.pub
and reboot the server.
[1]: https://documentation.online.net/en/dedicated-server/rescue/mount-lvm-partition
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment