LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-10-2012, 10:42 PM   #1
the_gripmaster
Member
 
Registered: Jul 2004
Location: VIC, Australia
Distribution: RHEL, CentOS, Ubuntu Server, Ubuntu
Posts: 364

Rep: Reputation: 38
Question Regenerating ssh files


After cloning a VM, how do I regenerate the files in /etc/ssh because these files are supposed to be different for different hosts:

Code:
[root@centos5 ~]# cd /etc/ssh
[root@centos5 ssh]# 
[root@centos5 ssh]# ls -1
moduli
ssh_config
sshd_config
ssh_host_dsa_key
ssh_host_dsa_key.pub
ssh_host_key
ssh_host_key.pub
ssh_host_rsa_key
ssh_host_rsa_key.pub
  • The ssh_host_* files can be recreated using ssh-keygen.
  • The ssh*_config files can stay the same.
  • How do I recreate the moduli?
 
Old 07-10-2012, 10:58 PM   #2
the_gripmaster
Member
 
Registered: Jul 2004
Location: VIC, Australia
Distribution: RHEL, CentOS, Ubuntu Server, Ubuntu
Posts: 364

Original Poster
Rep: Reputation: 38
I think I found it

Code:
ssh-keygen -G moduli.candidates -b 2048
ssh-keygen -T moduli -f moduli.candidates

Last edited by the_gripmaster; 07-11-2012 at 12:55 AM.
 
Old 07-11-2012, 12:53 AM   #3
the_gripmaster
Member
 
Registered: Jul 2004
Location: VIC, Australia
Distribution: RHEL, CentOS, Ubuntu Server, Ubuntu
Posts: 364

Original Poster
Rep: Reputation: 38
It looks like moduli is the same set of groups on all CentOS servers. So it does not need to be regenerated. In case someone is looking for the same, here are the complete steps to recreate the private and public keys:

Code:
ssh-keygen -C '' -t dsa -f /etc/ssh/ssh_host_dsa_key
ssh-keygen -C '' -t rsa -f /etc/ssh/ssh_host_rsa_key
ssh-keygen -C '' -t rsa1 -f /etc/ssh/ssh_host_key

Last edited by the_gripmaster; 07-11-2012 at 12:56 AM.
 
Old 07-11-2012, 12:58 AM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
The /etc/init.d/sshd init script already checks for and will generate them OTF if these files are not available, so basically delete the keys and restart the service.
 
1 members found this post helpful.
  


Reply

Tags
ssh



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
Regenerating Old PCs.. EchoNation Linux - Newbie 24 01-07-2012 03:10 AM
/var/log/httpd/sea_urchin keeps regenerating latasha Linux - General 1 05-10-2011 03:46 PM
access files over ssh as local files Four Linux - Newbie 1 02-26-2009 05:02 PM
LXer: ssh-xfer: Quickly grabbing files over an existing SSH connection LXer Syndicated Linux News 0 08-08-2008 03:11 PM
can Linux block files on my Windows partition from regenerating? newbiesforever General 1 02-08-2008 03:06 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

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

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