SSH scp error no hostkey alg

ssh works well but when you try to copy a file via scp you get this error

no hostkey alg

Go on your server and check if you have /etc/ssh/ssh_host_rsa_key and /etc/ssh/ssh_host_dsa_key files, if not, generate them

ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key
ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key

SSH Read from socket failed: Connection reset by peer

After installing a container with lxc I wasn’t able to connect via ssh to my container, I get the following message :

root@ns313:~# ssh 10.50.10.10
Read from socket failed: Connection reset by peer

Network works normally, I can ping, hotst both direction and I can get pages from apache’s container from the dom0.

I tried to connect to ssh from container, in local and I get the same error.

root@container:/etc/ssh#ssh 10.50.10.10 -l root
Read from socket failed: Connection reset by peer

Strange, first time ssh doesn’t work on any machine.
Try restart sshd

root@container:/etc/ssh# /etc/init.d/ssh restart
Could not load host key: /etc/ssh/ssh_host_rsa_key
Could not load host key: /etc/ssh/ssh_host_dsa_key
Could not load host key: /etc/ssh/ssh_host_ecdsa_key
[....] Restarting OpenBSD Secure Shell server: sshdCould not load host key: /etc/ssh/ssh_host_rsa_key
Could not load host key: /etc/ssh/ssh_host_dsa_key
Could not load host key: /etc/ssh/ssh_host_ecdsa_key
. ok 

SSH keys are missing, to fix it, run this command :

root@container:/etc/ssh# ssh-keygen -t ecdsa -f /etc/ssh/ssh_host_ecdsa_key -N ''

SSH How to connect without password

A classic hack for linux users, connect via ssh without password.

First, on your client, generate public key

ssh-key-gen -t rsa

keep ~/.ssh/id_rsa by default.

Copy public key (~/.ssh/id_rsa.pub) from your client to the file ~/.ssh/authorized_keys2 on the server with the ssh-copy-id binary.

Then edit your ~/.ssh/config file on client side to custom your params:

Host dev
  HostName dev.domain.com
  Port 22
  User root

Finaly, you can add an alias in your ~/.bashrc

alias dev='ssh dev'

Now, to launche a ssh connection, just run

dev