(→같이 보기) |
Jmnote bot (토론 | 기여) 잔글 (봇: 자동으로 텍스트 교체 (-<source +<syntaxhighlight , -</source> +</syntaxhighlight>)) |
||
(사용자 3명의 중간 판 22개는 보이지 않습니다) | |||
2번째 줄: | 2번째 줄: | ||
;리눅스 ssh-keygen | ;리눅스 ssh-keygen | ||
;/usr/bin/ssh-keygen | ;/usr/bin/ssh-keygen | ||
==ssh-keygen== | |||
*Unix [[SSH|SSH(Secure Shell)]] 프로토콜을 사용하기 위한 표준 컴포넌트 | |||
* 키생성, 키관리, 인증키 변환을 위한 툴 | |||
== | ==문법== | ||
< | *문법 | ||
<syntaxhighlight lang='bash'> | |||
ssh-keygen [options] | |||
</syntaxhighlight> | |||
*옵션 | |||
{| class='wikitable' | |||
! 옵션 !! 설명 !! 비고 | |||
|- | |||
| -b bits || 생성할 키 비트수 지정. 최소 768비트가 필요하며 디폴트 값으로 2048비트로 설정되어 있음|| | |||
|- | |||
| -C comment || 주석 입력 가능. 서버에 따라 특별한 용도로 사용 하기도 함|| | |||
|- | |||
| -t || 어떠한 암호화 방식을 사용 할 것인지를 지정|| $ssh-keygen -t rsa → rsa암호화 방식으로 키 생성 | |||
|- | |||
| -f || 저장할 파일명 지정. 경로 지정 가능 || | |||
|} | |||
==실행예시: 기본 실행== | |||
* 아무 옵션 없이 실행하면 대화식 진행 ( 기본 위치: [[~/.ssh/id_rsa]] ) | |||
<syntaxhighlight lang='console'> | |||
[root@zetawiki ~]# ssh-keygen | [root@zetawiki ~]# ssh-keygen | ||
Generating public/private rsa key pair. | Generating public/private rsa key pair. | ||
Enter file in which to save the key (/root/.ssh/id_rsa): | Enter file in which to save the key (/root/.ssh/id_rsa): | ||
</ | </syntaxhighlight> | ||
:→ {{Enter}} | :→ {{Enter}} | ||
< | <syntaxhighlight lang='console'> | ||
Enter passphrase (empty for no passphrase): | Enter passphrase (empty for no passphrase): | ||
Enter same passphrase again: | Enter same passphrase again: | ||
</ | </syntaxhighlight> | ||
:→ 암호 2번 입력 | :→ 암호 2번 입력 | ||
:→ [[SSH 자동로그인]]을 하려면 암호를 입력하지 않고 {{Enter}} 2번 | :→ [[SSH 자동로그인]]을 하려면 암호를 입력하지 않고 {{Enter}} 2번 | ||
< | <syntaxhighlight lang='console'> | ||
Your identification has been saved in /root/.ssh/id_rsa. | Your identification has been saved in /root/.ssh/id_rsa. | ||
Your public key has been saved in /root/.ssh/id_rsa.pub. | Your public key has been saved in /root/.ssh/id_rsa.pub. | ||
33번째 줄: | 56번째 줄: | ||
|=o.o | | |=o.o | | ||
+-----------------+ | +-----------------+ | ||
</ | </syntaxhighlight> | ||
*다음과 같이 개인키(id_rsa), 공개키(id_rsa.pub) 파일이 생성되었음 | *다음과 같이 개인키(id_rsa), 공개키(id_rsa.pub) 파일이 생성되었음 | ||
< | <syntaxhighlight lang='console'> | ||
[root@zetawiki ~]# ll ~/.ssh/id_rsa* | [root@zetawiki ~]# ll ~/.ssh/id_rsa* | ||
-rw------- 1 root root 1743 Sep 4 14:28 /root/.ssh/id_rsa | -rw------- 1 root root 1743 Sep 4 14:28 /root/.ssh/id_rsa | ||
-rw-r--r-- 1 root root 390 Sep 4 14:28 /root/.ssh/id_rsa.pub | -rw-r--r-- 1 root root 390 Sep 4 14:28 /root/.ssh/id_rsa.pub | ||
</ | </syntaxhighlight> | ||
==실행예시: -f 옵션== | |||
{{참고|ssh-keygen -f}} | |||
<syntaxhighlight lang='console'> | |||
root@zetawiki:~# ssh-keygen -f my-ssh-key.pem | |||
Generating public/private rsa key pair. | |||
Enter passphrase (empty for no passphrase): | |||
Enter same passphrase again: | |||
Your identification has been saved in my-ssh-key.pem. | |||
Your public key has been saved in my-ssh-key.pem.pub. | |||
The key fingerprint is: | |||
ac:5b:fb:32:75:2c:43:25:2f:0e:a7:8e:33:a3:88:42 root@zetawiki | |||
The key's randomart image is: | |||
+--[ RSA 2048]----+ | |||
| | | |||
| . . | | |||
| + | | |||
| .. + . | | |||
| S* o | | |||
| E .. = o | | |||
|. .o.. + | | |||
|.. . =o+. | | |||
|o . ...+.+. | | |||
+-----------------+ | |||
</syntaxhighlight> | |||
<syntaxhighlight lang='console'> | |||
root@zetawiki:~# ll my-ssh-key.pem* | |||
-rw------- 1 root root 1679 Feb 9 14:33 my-ssh-key.pem | |||
-rw-r--r-- 1 root root 395 Feb 9 14:33 my-ssh-key.pem.pub | |||
</syntaxhighlight> | |||
==실행예시: -lf 옵션== | |||
{{참고|ssh-keygen -lf}} | |||
==같이 보기== | ==같이 보기== | ||
47번째 줄: | 103번째 줄: | ||
*[[리눅스 ssh-copy-id]] | *[[리눅스 ssh-copy-id]] | ||
*[[리눅스 ssh-keyscan]] | *[[리눅스 ssh-keyscan]] | ||
*[[리눅스 openssl]] | |||
*[[~/.ssh/id_rsa, id_rsa.pub]] | *[[~/.ssh/id_rsa, id_rsa.pub]] | ||
*[[RSA]] | *[[RSA]] | ||
==참고 | ==참고== | ||
*http://ebroder.net/2010/01/18/ssh-keygen-randomart/ | *http://ebroder.net/2010/01/18/ssh-keygen-randomart/ | ||
*https://en.wikipedia.org/wiki/Ssh-keygen | |||
* http://man.openbsd.org/OpenBSD-current/man1/ssh-keygen.1#NAME | |||
[[분류: | [[분류: ssh-keygen]] | ||
2021년 9월 24일 (금) 23:26 기준 최신판
- 리눅스 RSA 2048 공개키, 개인키 생성
- 리눅스 ssh-keygen
- /usr/bin/ssh-keygen
1 ssh-keygen[ | ]
- Unix SSH(Secure Shell) 프로토콜을 사용하기 위한 표준 컴포넌트
- 키생성, 키관리, 인증키 변환을 위한 툴
2 문법[ | ]
- 문법
Bash
Copy
ssh-keygen [options]
- 옵션
옵션 | 설명 | 비고 |
---|---|---|
-b bits | 생성할 키 비트수 지정. 최소 768비트가 필요하며 디폴트 값으로 2048비트로 설정되어 있음 | |
-C comment | 주석 입력 가능. 서버에 따라 특별한 용도로 사용 하기도 함 | |
-t | 어떠한 암호화 방식을 사용 할 것인지를 지정 | $ssh-keygen -t rsa → rsa암호화 방식으로 키 생성 |
-f | 저장할 파일명 지정. 경로 지정 가능 |
3 실행예시: 기본 실행[ | ]
- 아무 옵션 없이 실행하면 대화식 진행 ( 기본 위치: ~/.ssh/id_rsa )
Console
Copy
[root@zetawiki ~]# ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
- → ↵ Enter
Console
Copy
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
- → 암호 2번 입력
- → SSH 자동로그인을 하려면 암호를 입력하지 않고 ↵ Enter 2번
Console
Copy
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
20:e9:b0:5b:5a:2b:ad:e8:4d:e4:b3:a0:32:49:2d:97 evan
The key's randomart image is:
+--[ RSA 2048]----+
| |
| . |
| . o . |
| + . . |
| o.= S |
| ooE . |
|.o*+o |
|=.+oo |
|=o.o |
+-----------------+
- 다음과 같이 개인키(id_rsa), 공개키(id_rsa.pub) 파일이 생성되었음
Console
Copy
[root@zetawiki ~]# ll ~/.ssh/id_rsa*
-rw------- 1 root root 1743 Sep 4 14:28 /root/.ssh/id_rsa
-rw-r--r-- 1 root root 390 Sep 4 14:28 /root/.ssh/id_rsa.pub
4 실행예시: -f 옵션[ | ]
ssh-keygen -f 문서를 참고하십시오.
Console
Copy
root@zetawiki:~# ssh-keygen -f my-ssh-key.pem
Generating public/private rsa key pair.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in my-ssh-key.pem.
Your public key has been saved in my-ssh-key.pem.pub.
The key fingerprint is:
ac:5b:fb:32:75:2c:43:25:2f:0e:a7:8e:33:a3:88:42 root@zetawiki
The key's randomart image is:
+--[ RSA 2048]----+
| |
| . . |
| + |
| .. + . |
| S* o |
| E .. = o |
|. .o.. + |
|.. . =o+. |
|o . ...+.+. |
+-----------------+
Console
Copy
root@zetawiki:~# ll my-ssh-key.pem*
-rw------- 1 root root 1679 Feb 9 14:33 my-ssh-key.pem
-rw-r--r-- 1 root root 395 Feb 9 14:33 my-ssh-key.pem.pub
5 실행예시: -lf 옵션[ | ]
ssh-keygen -lf 문서를 참고하십시오.
6 같이 보기[ | ]
- 리눅스 known_hosts에서 호스트키 삭제
- 리눅스 RSA 개인키, 공개키 생성
- 리눅스 SSH 자동 로그인
- 리눅스 ssh-copy-id
- 리눅스 ssh-keyscan
- 리눅스 openssl
- ~/.ssh/id_rsa, id_rsa.pub
- RSA
7 참고[ | ]
편집자 John Jeong Jmnote bot
로그인하시면 댓글을 쓸 수 있습니다.