NAS/Synology
[시놀로지] RSA 공개키로 ssh 접속 설정
노나카
2020. 4. 13. 18:30
비밀번호 없이 시놀로지 ssh 접속을 위한 설정 방법
[ Client 장비 ]
1. RSA 공개키 생성
# ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
Generating public/private rsa key pair.
Enter file in which to save the key (/home/app/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/app/.ssh/id_rsa.
Your public key has been saved in /home/app/.ssh/id_rsa.pub.
The key fingerprint is:
d9:21:a2:3d:a3:21:07:52:cd:bb:ed:a8:51:d9:56:09 your_email@example.com
The key's randomart image is:
+--[ RSA 4096]----+
| .o E |
| . o . . |
|. . .. + . |
| . ..= o + . |
| . *o* S . |
| +.+.o |
| . .o |
| .. . |
| .. |
+-----------------+
2. 공개키 확인
# cat .ssh/id_rsa.pub
3. 공개키 저장 또는 시놀로지 업로드
[ 시놀로지 설정 ]
1. 제어판 -> 터미널 및 SNMP -> 터미널 탭에서 SSH 서비스 활성화
2. 접속하려는 계정의 그룹 확인 ( Administrators 그룹만 ssh 지원 )
3. 시놀로지 SSH 접속 후 ssh 설정 변경 후 리로드
sudo vi /etc/ssh/sshd_config
## 아래의 내용 주석 삭제 후 저장
RSAAuthentication yes
PubkeyAuthentication yes
# reload
sudo synoservicectl --reload sshd
4. Client 공개키 내용을 접속하려는 시놀로지 계정의 ~/.ssh/authorized_keys 에 등록
cat ~/id_rsa.pub >> ~/.ssh/authorized_keys