Tuesday, October 28, 2014

Generate new SSH key

root@pulpfiction:~# cd /etc/ssh
root@pulpfiction:/etc/ssh# ls
moduli      sshd_config       ssh_host_dsa_key.pub  ssh_host_ecdsa_key.pub  ssh_host_rsa_key.pub
ssh_config  ssh_host_dsa_key  ssh_host_ecdsa_key    ssh_host_rsa_key
root@pulpfiction:/etc/ssh# ls -a
.   moduli      sshd_config       ssh_host_dsa_key.pub  ssh_host_ecdsa_key.pub  ssh_host_rsa_key.pub
..  ssh_config  ssh_host_dsa_key  ssh_host_ecdsa_key    ssh_host_rsa_key
root@pulpfiction:/etc/ssh# mkdir keys_default
root@pulpfiction:/etc/ssh# mv ssh_host_* keys_default/
root@pulpfiction:/etc/ssh# ls
keys_default  moduli  ssh_config  sshd_config
root@pulpfiction:/etc/ssh# cd keys_Default
bash: cd: keys_Default: No such file or directory
root@pulpfiction:/etc/ssh# cd keys_Default
bash: cd: keys_Default: No such file or directory
root@pulpfiction:/etc/ssh# cd keys*
root@pulpfiction:/etc/ssh/keys_default# ls
ssh_host_dsa_key  ssh_host_dsa_key.pub  ssh_host_ecdsa_key  ssh_host_ecdsa_key.pub  ssh_host_rsa_key  ssh_host_rsa_key.pub
root@pulpfiction:/etc/ssh/keys_default# cd .
root@pulpfiction:/etc/ssh/keys_default# cd ..
root@pulpfiction:/etc/ssh# dpkg-reconfigure openssh-server
Creating SSH2 RSA key; this may take some time ...
Creating SSH2 DSA key; this may take some time ...
Creating SSH2 ECDSA key; this may take some time ...
insserv: warning: current start runlevel(s) (empty) of script `ssh' overrides LSB defaults (2 3 4 5).
insserv: warning: current stop runlevel(s) (2 3 4 5) of script `ssh' overrides LSB defaults (empty).
root@pulpfiction:/etc/ssh# md5sum ssh_host_*
7e0e98ccbbb3c6c9c0324ce78f7a30b2  ssh_host_dsa_key
25e95c30e94421d0c54a4d8d0fc  ssh_host_dsa_key.pub
6b61f6cabd97a5a33cfa2eaf66f4b2b5  ssh_host_ecdsa_key
060d8943e599272fc7bfb08593  ssh_host_ecdsa_key.pub
303dd1937c094d3fb9da0e1bbf8af38e  ssh_host_rsa_key
1b2d28ba6fdc886asdf7fcd4505a9fa  ssh_host_rsa_key.pub
root@pulpfiction:/etc/ssh# cd key_default
bash: cd: key_default: No such file or directory
root@pulpfiction:/etc/ssh# cd keys_default
root@pulpfiction:/etc/ssh/keys_default# md5sum ssh_host_*
89351fdb4411ce0cdf307617dbbb66a5  ssh_host_dsa_key
3ce46c8d171e372bbfbca3c4aee9fb03  ssh_host_dsa_key.pub
22678cc53669a4cb046c80ed0ede91a4  ssh_host_ecdsa_key
a6a0d18997ddd71985dd9b688a6b8385  ssh_host_ecdsa_key.pub
3af17b8c66ed16bea31a35c94ac47a44  ssh_host_rsa_key
4ff6df59fa0f2a956dab9d05b27b983a  ssh_host_rsa_key.pub
root@pulpfiction:/etc/ssh/keys_default# /etc/init.d/ssh start
[ ok ] Starting OpenBSD Secure Shell server: sshd.

root@pulpfiction:/etc/ssh/keys_default# netstat -antp
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      6551/sshd      
tcp6       0      0 :::22                   :::*                    LISTEN      6551/sshd  

No comments:

Post a Comment