štvrtok 21. septembra 2023

ssh -issue: no hostkeys available --exiting

 I installed Ubuntu 22.04 server for testing in my "ansible learning". First problem was with ssh. Ssh is very necessary in ansible communication. How it fixed? 


yes yes, try google if you can ;-) 


my scenario: 


I tried add new installed server to static inventory /etc/ansible/hosts 

--ssh connection didn't work  

 


 If you know very well, when we have a problem with ssh connection Port 22: Connection refused -- there is a problem with network connection. 

Problem was about settings sshd service

- when you go sshd -t (check /etc/ssh/sshd file) --> you see what's the problem: 

and error output was: sshd: no hostkeys available -- exiting

 

How it fixed? 


I used google of course ;-) 

 

- generate ssh keys via

ssh-keygen -A 

and restart sshd

so: 

1. ssh-keygen -A 

2. systemctl restart sshd 

3. for more adventure people (chmod -x -R /bin ;-) (don't use, it's a joke of course)

after that: check /etc/ssh directory

root@martin:~# ll /etc/ssh/
total 556
drwxr-xr-x  4 root root   4096 Sep 21 19:43 ./
drwxr-xr-x 97 root root   4096 Sep 21 19:43 ../
-rw-r--r--  1 root root 505426 Nov 23  2022 moduli
-rw-r--r--  1 root root   1650 Nov 23  2022 ssh_config
drwxr-xr-x  2 root root   4096 Nov 23  2022 ssh_config.d/
-rw-------  1 root root   1381 Sep 21 19:43 ssh_host_dsa_key
-rw-r--r--  1 root root    601 Sep 21 19:43 ssh_host_dsa_key.pub
-rw-------  1 root root    505 Sep 21 19:43 ssh_host_ecdsa_key
-rw-r--r--  1 root root    173 Sep 21 19:43 ssh_host_ecdsa_key.pub
-rw-------  1 root root    399 Sep 21 19:43 ssh_host_ed25519_key
-rw-r--r--  1 root root     93 Sep 21 19:43 ssh_host_ed25519_key.pub
-rw-------  1 root root   2602 Sep 21 19:43 ssh_host_rsa_key
-rw-r--r--  1 root root    565 Sep 21 19:43 ssh_host_rsa_key.pub

-rw-r--r--  1 root root    342 Dec  7  2020 ssh_import_id
-rw-r--r--  1 root root   3239 Sep 21 19:41 sshd_config
drwxr-xr-x  2 root root   4096 Jul 30 15:43 sshd_config.d/

source: use this web;-) 


https://support.tools/post/wsl-ssh-server-keys/

Žiadne komentáre:

Zverejnenie komentára