![Debian 8 VPS - 다시 시작하면 호스트 SSH 키가 다시 생성됩니다.](https://linux55.com/image/108634/Debian%208%20VPS%20-%20%EB%8B%A4%EC%8B%9C%20%EC%8B%9C%EC%9E%91%ED%95%98%EB%A9%B4%20%ED%98%B8%EC%8A%A4%ED%8A%B8%20SSH%20%ED%82%A4%EA%B0%80%20%EB%8B%A4%EC%8B%9C%20%EC%83%9D%EC%84%B1%EB%90%A9%EB%8B%88%EB%8B%A4..png)
데비안 8을 재부팅할 때마다 새로운 호스트 RSA 키가 생성되기 때문에 문제가 있습니다. 이 상황을 피하는 방법은 무엇입니까?
답변1
좋아요, 왜 이런 일이 일어나는지 압니다. /etc/rc.local에 스크립트가 있습니다:
#!/bin/sh
rm -f etc/ssh/ssh_host_*
/usr/bin/ssh-keygen -t rsa -N '' -f /etc/ssh/ssh_host_rsa_key
/usr/bin/ssh-keygen -t dsa -N '' -f /etc/ssh/ssh_host_dsa_key
/usr/bin/ssh-keygen -t rsa1 -N '' -f /etc/ssh/ssh_host_key
/usr/bin/ssh-keygen -t ecdsa -N '' -f /etc/ssh/ssh_host_ecdsa_key
/usr/bin/ssh-keygen -t ed25519 -N '' -f /etc/ssh/ssh_host_ed25519_key
systemctl restart ssh
DHCP6CCTLKEY=/etc/wide-dhcpv6/dhcp6cctlkey
# The key mustn\'t be world readable
umask 066
echo "Generating ${DHCP6CCTLKEY}..." >&2
dd if=/dev/random bs=32 count=1 2>/dev/null | uuencode -m ${DHCP6CCTLKEY} | head -n 2 | tail -n 1 > ${DHCP6CCTLKEY}
umask 022
mv -f /etc/rc.local.orig /etc/rc.local