shell에서 다음 명령 실행
ssh-keygen
키 생성이 완료되면 홈 디렉토리 내 .ssh
디렉토리 - id_rsa
(개인키)와 id_rsa.pub
(공개키)가 생성됨
아래 명령으로 id_rsa.pub
를 authorized_keys 파일에 추가
cd .ssh
cat id_rsa.pub >> authorized_keys
id_rsa
(개인키) 파일 접속할 PC에 복사
putty로 접속할 경우 아래 url에서 putty 설치 후 puttygen으로 ppk 파일로 변환
기타 설정
sudo vi /etc/ssh/sshd_config
AuthorizedKeysFile %h/.ssh/authorized_keys => 찾아서 주석 제거
RSAAuthentication yes
PubkeyAuthentication yes
IgnoreRhosts yes
RhostsRSAAuthentication no
HostbasedAuthentication no
PermitEmptyPasswords no
ChallengeResponseAuthentication no
PasswordAuthentication no
PermitRootLogin no
sudo service sshd restart