LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   Use the same SSH key on a remote host with various ghosted installations ? (http://www.linuxquestions.org/questions/slackware-14/use-the-same-ssh-key-on-a-remote-host-with-various-ghosted-installations-4175436548/)

kikinovak 11-10-2012 07:41 AM

Use the same SSH key on a remote host with various ghosted installations ?
 
Hi,

In my office I have two sandbox PC which I use extensively for testing. These machines have various installs, which are all backed up on a local FTP server using G4L (Ghost4Linux). For example:
  • Slackware 14.0 vanilla
  • Slackware 14.0 server (with Squid, SquidGuard, configured Samba, ...)
  • Slackware 14.0 desktop (custom Xfce)
  • RHEL 5.8
  • Windows XP (mainly for testing Samba file and print server)

One small problem that's nagging me is that everytime I change the install on a machine by downloading a different image from the ghost server, I get the usual someone-is-doing-something-nasty warning from SSH, as is to be expected. So I open ~/.ssh/known_hosts on my main PC, delete the relevant line with the offending key, and then I can go on with my work.

Now I know how to generate keys to be able to do passwordless logins to various remote hosts. What I don't know can only be described as: how do I go about it the other way around? Meaning how can I tweak my three different Slackware and one RHEL installs so I can log into them using SSH using the same key on my main workhorse PC? (Security is no concern here, as these are only local sandbox machines...)

When Slackware starts up the first time after installation, there's a message about "generating SSH keys". Now I think all I have to do is find the relevant files where these are stored and then replace them all by the same file or set of files. Any idea how I have to go about this?

Cheers,

Niki

Woodsman 11-10-2012 11:12 AM

For each user, the public and private keys are stored in $HOME/.ssh. Copy the public key from the client machine to $HOME/.ssh/authorized_keys on the host machine. Also add the client machine to $HOME/.ssh/known_hosts.

Petri Kaukasoina 11-10-2012 12:31 PM

Quote:

Originally Posted by kikinovak (Post 4826476)
When Slackware starts up the first time after installation, there's a message about "generating SSH keys". Now I think all I have to do is find the relevant files where these are stored and then replace them all by the same file or set of files.

Code:

ls -l /etc/ssh/ssh_host_*key*

kikinovak 11-11-2012 11:24 AM

Quote:

Originally Posted by Petri Kaukasoina (Post 4826599)
Code:

ls -l /etc/ssh/ssh_host_*key*

Thanks very much, that worked! I copied over this bunch of files from my initial installation to the other ghosted systems, and now I can ssh into every single one of them without always having to recreate a new key.

Cheers,

Niki


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