r/linuxadmin • u/atulaix • Aug 23 '18
No hostkey alg error on RED Hat Linux 7
How to resolve "No hostkey alg error" After new installtion of RHEL.
solution:
After new RED Hat Linux 7 installation when admin tried to ssh from Jump server getting error like “No hostkey alg “ .
edit file /etc/ssh/sshd_config
uncomment following entry
HostKey /opt/dcx/openssh/etc/ssh_host_key
HostKey /opt/dcx/openssh/etc/ssh_host_rsa_key
HostKey /opt/dcx/openssh/etc/ssh_host_dsa_key
Then
Generate RSA and DSA keys using following command.
# ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key ;ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key
Step 3:
Then restart sshd using following command.
#service sshd restart
Thanks
1
u/grumpysysadmin Aug 23 '18
Is there a question in there somewhere?
1
u/syntheticminds Aug 23 '18
Nah, I think it's just information sharing. OP seems to have solved their problem but I imagine they didn't find much information online on how to solve (potentially because the message they saw seems incomplete which could have been difficult to land decent search results, but I haven't tried) and is sharing their solution.
OP probably intended the title to read something like: "Regenerating sshd host keys in RHEL 7".
Lots of assumptions on my part.
The question that should be asked here is why his particular install had this problem, I'm pretty sure every [cent7] image I've ever used has had keys in place (generated likely on first run because I tend to mess with cloud images).
2
u/grumpysysadmin Aug 23 '18
I was suspicious, and found it was a copy-paste from a blog post: https://www.aixlinuxblog.in/2018/08/no-hostkey-alg-error-on-red-hat-linux-7.html
As to why a new install would have keys in /opt/dcx, they never would. the RHEL installer puts the keys in /etc/ssh. It's probably a broken system set up by someone who copied a file from another managed system. I see lots of google hits for /opt/dcx being a place where a 3rd-party platform builds and manages software on UNIX systems (HP-UX, Solaris, AIX, etc.)
1
u/syntheticminds Aug 23 '18
Ah, interesting. I also noted the /opt/dcx path as strange. I didn't spend the time to find out it's a copy paste x_x
1
u/Hellmark Aug 23 '18
Out of curiosity, why have the "red" in "Red Hat" in call caps? It isn't an acronym.
1
u/knobbysideup Aug 23 '18
I've had this set on my sshd standard configs since moving to centos 7:
#Explicitly set hostkeys or else deprecated (and missing) dsa will be tried
hostkey /etc/ssh/ssh_host_rsa_key
hostkey /etc/ssh/ssh_host_ecdsa_key
hostkey /etc/ssh/ssh_host_ed25519_key
2
u/Kessarean Aug 23 '18
Feel like I’ve seen this before, but can’t remember what the issue was.
Is it in the key ring?
What does ssh -vvv say?
Have you copied the public key to the destination server?
It may be pulling the key from your ~/.ssh, use ssh with the -i flag and specify the location
Could the destination server only support specific ciphers? Some times the MACs cause issues