LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Laptop and Netbook
User Name
Password
Linux - Laptop and Netbook Having a problem installing or configuring Linux on your laptop? Need help running Linux on your netbook? This forum is for you. This forum is for any topics relating to Linux and either traditional laptops or netbooks (such as the Asus EEE PC, Everex CloudBook or MSI Wind).

Notices


Reply
  Search this Thread
Old 10-18-2015, 02:38 PM   #1
jijeesh_in@yahoo.com
LQ Newbie
 
Registered: Oct 2015
Posts: 4

Rep: Reputation: Disabled
Help me - SSH key generation failed.


I installed Rhel 7 in my laptop and i could not start the sshd session. It always says that as below :
sshd-keygen: generating ssh2 rsa host key failed.

I tried to generate the key manually, but it not works.
Due to this am unable to connect the session with putty. Could anyone help me please.
 
Old 10-18-2015, 04:15 PM   #2
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
please provide the exact commands you used, and everything they returned. please use the "-v" switch (=verbose) for ssh-keygen.
and some general info, in as much detail as you can.
 
Old 10-19-2015, 08:28 AM   #3
jijeesh_in@yahoo.com
LQ Newbie
 
Registered: Oct 2015
Posts: 4

Original Poster
Rep: Reputation: Disabled
pls find the details.

I understood that in deafault the keys should be generated in /etc/ssh dir while installing. But i could not find the keys available in the dir.
I tried to start the sshd to login with putty and it thrown the error

systemctl status sshd ---> gives
Active: activating (auto-restart)
process: 12234 Execstartpre=/usr/sbin/ssh-keygen (code=exited, status=1/Failure)

sshd.service: control process exited,
Failed to start openssh server daemon.
unit sshd.service entered failed state.

When i used the command sshd -t
could not load host key: /etc/ssh/ssh/ssh_host_rsa_key
could not load host key: /etc/ssh/ssh/ssh_host_ecdsa_key

sshd-keygen -t rsa --------> gives
Generating ssh2 rsa host key: [FAILED]
 
Old 10-19-2015, 11:15 AM   #4
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,622

Rep: Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964Reputation: 7964
Quote:
Originally Posted by jijeesh_in@yahoo.com View Post
I understood that in deafault the keys should be generated in /etc/ssh dir while installing. But i could not find the keys available in the dir.
I tried to start the sshd to login with putty and it thrown the error

systemctl status sshd ---> gives
Active: activating (auto-restart)
process: 12234 Execstartpre=/usr/sbin/ssh-keygen (code=exited, status=1/Failure)

sshd.service: control process exited,
Failed to start openssh server daemon.
unit sshd.service entered failed state.

When i used the command sshd -t
could not load host key: /etc/ssh/ssh/ssh_host_rsa_key
could not load host key: /etc/ssh/ssh/ssh_host_ecdsa_key

sshd-keygen -t rsa --------> gives
Generating ssh2 rsa host key: [FAILED]
Please see the LQ Rules about text-speak..and about not using it.

And you still haven't told us what version/distro of Linux you're using, so it's hard to provide details. Putty doesn't enter into this, since it's just a terminal client, and it sounds like you don't have SSH running on your Linux system. Are you running as root when you try to start that service? If you're not...it won't work.
 
Old 10-19-2015, 05:35 PM   #5
jijeesh_in@yahoo.com
LQ Newbie
 
Registered: Oct 2015
Posts: 4

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by TB0ne View Post
Please see the LQ Rules about text-speak..and about not using it.

And you still haven't told us what version/distro of Linux you're using, so it's hard to provide details. Putty doesn't enter into this, since it's just a terminal client, and it sounds like you don't have SSH running on your Linux system. Are you running as root when you try to start that service? If you're not...it won't work.

Hi, Am sorry.

Am using Toshiba Laptop -- 4GB RAM with Windows 10.
Installed Redhat Linux 7 through Orcale VM Virtual Box Manager. The sshd process is not running and am unable to start it though.

Am trying to start the sshd service through Root. Please let me know, if you required any additional information.
 
Old 10-20-2015, 01:27 AM   #6
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
you should have root privileges to start the daemon, but everything else you should do as a normal user, afaik.
generating & storing the keys in /etc/ssh seems extremely wrong to me.
i'm not surprised sshd refuses to start if you've been messing around in its system-wide config directory.
ssh is very particular about file permission (and a good thing too! after all you're opening your machine to the world!).
i suggest you check out a few of the ~100.000 ssh tutorials out there.

ps:
i still don't see how you are (re)starting the sshd, unless you are rebooting your machine after every change?
have you ever issued "sudo systemctl restart sshd"?

Last edited by ondoho; 10-20-2015 at 01:28 AM.
 
Old 10-21-2015, 06:46 PM   #7
jijeesh_in@yahoo.com
LQ Newbie
 
Registered: Oct 2015
Posts: 4

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by ondoho View Post
you should have root privileges to start the daemon, but everything else you should do as a normal user, afaik.
generating & storing the keys in /etc/ssh seems extremely wrong to me.
i'm not surprised sshd refuses to start if you've been messing around in its system-wide config directory.
ssh is very particular about file permission (and a good thing too! after all you're opening your machine to the world!).
i suggest you check out a few of the ~100.000 ssh tutorials out there.

ps:
i still don't see how you are (re)starting the sshd, unless you are rebooting your machine after every change?
have you ever issued "sudo systemctl restart sshd"?

Thanks Bro,

I used "systemctl restart sshd" through root. I executed "sudo systemctl restart sshd" and receives the same error.
job for sshd.service failed. See 'systemctl status ssdh.service' and 'journalctl -xn' for details.



systemctl status sshd.service gives
Active: activating (auto-restart)
process: 12234 Execstartpre=/usr/sbin/ssh-keygen (code=exited, status=1/Failure)

sshd.service: control process exited,
Failed to start openssh server daemon.
unit sshd.service entered failed state.


journalctl -xn ---> says

Unit sshd.service has begun starting up.
sshd-keygen: Generating SSH2 RSA host key: [failed]
sshd.service: control process exited, code=exit.
Subject: Unit sshd.service has failed.
define-by: systemd
Unit sshd.service has failed.
The result is failed.
 
Old 10-23-2015, 12:18 PM   #8
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
i'm not your bro.

let's recap:
you are running the sshd daemon on your rhel server.
you want to connect to this server from some other machine via ssh. (putty suggests windows?)
for that you have to generate a key pair on the client machine, not the server (if you want passwordless login).

i have no clue why your sshd wants to generate keys upon startup, but i suspect it's because you've been messing around in /etc/ssh.
i could be wrong though.
i'm not using rhel.

i suggest you find out if it's normal that sshd on rhel wants to run a command called "sshd-keygen" (on my debian server there's no such command, only ssh-keygen).
after that you should find a good ssh tutorial, and understand what is the server side and what is the client side, amongst other things.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
RSA Public Key generation resets automatically halting SSH between linux servers Karthick2388 Linux - Server 10 03-25-2012 11:48 PM
[SOLVED] Can not ssh into Slack 13.37, 'Host key verification failed'. camorri Slackware 13 07-15-2011 01:37 PM
Putty/SSH login failed when using RSA public key: 'Server refused our key' itsecx@gmail.com Linux - Server 10 10-04-2010 01:19 PM
failed ssh RSA key authentication jdarren Linux - Networking 15 07-06-2008 10:25 AM
ssh problem: key exchange failed feetyouwell Solaris / OpenSolaris 5 02-11-2005 01:27 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Laptop and Netbook

All times are GMT -5. The time now is 02:02 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration