
07B. ์ธ๋ถ ํค ์ ํ์ผ ์ฌ์ฉํ๊ธฐ
07B. ์ธ๋ถ ํค ์ ํ์ผ ์ฌ์ฉํ๊ธฐ ๊ด๋ จ

์ด๋ฏธ ๊ฐ์ง๊ณ ์๋ ํค ์ ํ์ผ ํน์ ์ธ๋ถ์์ ์์ฑํ ํค ์ ํ์ผ์ AWS ํค ์์ผ๋ก ๋ฃ๋ ๋ฐฉ๋ฒ์ ์์๋ณด๊ฒ ์ต๋๋ค. ํนํ Linux๋ Mac OS X์ ์ฌ์ฉํ๋ค ๋ณด๋ฉด SSH ํค ์ ํ์ผ์ ์ฌ๋ฌ ๊ฐ ์์ฑํ์ฌ ๊ฐ์ง๊ณ ์๊ฒ ๋ฉ๋๋ค. AWS์์ ๋๋ค์ ์๋ก์ด ํค ์์ ์์ฑํ๋ค๋ฉด ํค ์ ํ์ผ ๊ด๋ฆฌ๊ฐ ๋ค์ ๋ถ๋ด์ค๋ฌ์ธ ์ ์์ต๋๋ค. ๋ฐ๋ผ์ ์ด๋ฏธ ๊ฐ์ง๊ณ ์๋ ํค ์ ํ์ผ์ ํ์ฉํ๋ฉด ํค ์ ํ์ผ ๊ด๋ฆฌ ๋ถ๋ด์ ๋ ์ ์์ต๋๋ค.
PuTTY๋ก ์์ฑํ ํค ์ ํ์ผ ํ์ฉํ๊ธฐ
Windows์์ PuTTY๋ก ํค๋ฅผ ์์ฑํ๊ณ AWS ํค ์์ผ๋ก ๋ฃ์ด๋ณด๊ฒ ์ต๋๋ค.

PUTTYGEN.exe
๋ฅผ ์คํํ๊ณ PuTTY Key Generator์์ [Generate]
๋ฒํผ์ ํด๋ฆญํฉ๋๋ค.
์ด์ ํค ์์ฑ์ด ์๋ฃ๋์์ต๋๋ค.

[Save public key]
, [Save private key]
๋ฒํผ์ ์ฐจ๋ก๋๋ก ๋๋ฌ ํ์ผ๋ก ์ ์ฅํฉ๋๋ค.๋จผ์ Public Key๋ฅผ ์ ์ฅํฉ๋๋ค.

์ด์ Private Key๋ฅผ ์ ์ฅํฉ๋๋ค.

.ppk
ํ์ฅ์๋ฅผ ์ง์ ํฉ๋๋ค).
[์(Y)]
๋ฒํผ๋ฅผ ๋๋ฌ ๋น๋ฐ๋ฒํธ ์์ด ์ ์ฅํฉ๋๋ค.
[NETWORK & SECURITY]
โ [Key Pairs]
๋ฅผ ํด๋ฆญํ๊ณ , ์์ชฝ [Import Key Pair]
๋ฒํผ์ ํด๋ฆญํฉ๋๋ค.Import Key Pair ์ฐฝ์ด ํ์๋ฉ๋๋ค.

[Load public key from file]
ํ์ผ ์ ํ ๋ฒํผ์ ํด๋ฆญํฉ๋๋ค.
rsa-key-20140415
ํ์ผ์ ์ ํํฉ๋๋ค. ์ด ํ์ผ์ ๊ณต๊ฐ ํค(Public Key)์
๋๋ค.๊ณต๊ฐ ํค ํ์ผ ์ ๋ก๋๊ฐ ์๋ฃ๋์์ต๋๋ค.
- Key pair name: ์ฌ์ฉํ ํค ์ด๋ฆ์ ์ง์ ํฉ๋๋ค.
- Public key contents: ์๋์ผ๋ก ์
๋ก๋ ๋
rsa-key-20140415
ํ์ผ์ ๋ด์ฉ์ด ํ์๋ฉ๋๋ค. - Load public key from file๋ก ํ์ผ ์
๋ก๋๋ฅผ ํ์ง ์๊ณ
rsa-key-20140415
ํ์ผ ๋ด์ฉ์ ๋ณต์ฌํด์ Public key contents ๋ถ๋ถ์ ๋ถ์ฌ๋ฃ๊ธฐ ํด๋ ๋ฉ๋๋ค.

[Import]
๋ฒํผ์ ํด๋ฆญํฉ๋๋ค.
[NETWORK & SECURITY]
โ [Key Pairs]
)์ PuTTY Key Generator์์ ์์ฑํ ๊ณต๊ฐ ํค ํ์ผ ์ถ๊ฐ๋์์ต๋๋ค.Linux์ Mac OS X์์ ์์ฑํ ํค ์ ํ์ผ ํ์ฉํ๊ธฐ
Linux์ Mac OS X์์๋ SSH ํค ์์ด ๋งค์ฐ ๊ด๋ฒ์ํ๊ฒ ์ฌ์ฉ๋๊ณ ์์ต๋๋ค. ์ด๋ฒ์๋ Linux์ Mac OS X์์ ์์ฑํ SSH ํค ์ ํ์ผ์ AWS ํค ์์ผ๋ก ๋ฃ์ด๋ณด๊ฒ ์ต๋๋ค. ๋จผ์ ์์ ์ ๊ณ์ ์ SSH ํค ์ ํ์ผ์ด ์๋์ง ํ์ธํฉ๋๋ค. ํฐ๋ฏธ๋์์ ~/.ssh
๋๋ ํฐ๋ฆฌ๋ก ์ด๋ํ ๋ค ls -al
๋ก ํ์ผ์ด ์๋์ง ํ์ธํฉ๋๋ค.
cd ~/.ssh
ls -al
#
# ํฉ๊ณ 20
# drwx------ 2 pyrasis pyrasis 4096 4์ 15 20:53 .
# drwxr-xr-x 78 pyrasis pyrasis 4096 4์ 15 20:53 ..
# -rw------- 1 pyrasis pyrasis 1679 5์ 3 2013 id_rsa
# -rw-r--r-- 1 pyrasis pyrasis 408 5์ 3 2013 id_rsa.pub
# -rw-r--r-- 1 pyrasis pyrasis 3318 10์ 9 2013 known_hosts
SSH ํค ์ ํ์ผ์ด ์๋ค๋ฉด ssh-keygen -t rsa
๋ช
๋ น์ผ๋ก SSH ํค ์ ํ์ผ์ ์์ฑํฉ๋๋ค. id_rsa
, id_rsa.pub
๊ฒฝ๋ก๋ ๋ณ๊ฒฝํ์ง ์๊ณ ๊ธฐ๋ณธ๊ฐ ๊ทธ๋๋ก ์ฌ์ฉํฉ๋๋ค. ๊ทธ๋ฆฌ๊ณ Passphrase๋ ์๋ฌด๊ฒ๋ ์ค์ ํ์ง ์๊ณ ๊ธฐ๋ณธ๊ฐ ๊ทธ๋๋ก ๊ณต๋ฐฑ์ ์ฌ์ฉํฉ๋๋ค.
ssh-keygen -t rsa
#
# Generating public/private rsa key pair.
# Enter file in which to save the key (/home/pyrasis/.ssh/id_rsa):
# Enter passphrase (empty for no passphrase):
# Enter same passphrase again:
# Your identification has been saved in /home/pyrasis/.ssh/id_rsa.
# Your public key has been saved in /home/pyrasis/.ssh/id_rsa.pub.
# The key fingerprint is:
# 1a:99:3c:8e:d7:ed:f3:d8:94:57:ae:e7:d8:05:36:4b pyrasis@ubuntu
# The key's randomart image is:
# +--[ RSA 2048]----+
# | |
# | |
# | |
# | . o |
# | * S E .|
# | o = . + * |
# | . + . . o o o|
# | . ..+ . +o|
# | ooo ooo|
# +-----------------+

[NETWORK & SECURITY]
โ [Key Pairs]
๋ฅผ ํด๋ฆญํ๊ณ , ์์ชฝ [Import Key Pair]
๋ฒํผ์ ํด๋ฆญํฉ๋๋ค.Import Key Pair ์ฐฝ์ด ํ์๋ฉ๋๋ค.

[Load public key from file]
ํ์ผ ์ ํ ๋ฒํผ์ ํด๋ฆญํฉ๋๋ค.
.ssh
๋๋ ํฐ๋ฆฌ ์์ ์๋ id_rsa.pub
ํ์ผ์ ์ ํํ ํ [์ด๊ธฐ(O)]
๋ฒํผ์ ํด๋ฆญํฉ๋๋ค(ํ ๋๋ ํฐ๋ฆฌ์์ .ssh
๋๋ ํฐ๋ฆฌ๊ฐ ๋ณด์ด์ง ์์ ๊ฒฝ์ฐ ์์น(L) ๋ถ๋ถ์ .ssh
๋ฅผ ์
๋ ฅํ ํ ์ํฐ๋ฅผ ์น๋ฉด .ssh
๋๋ ํฐ๋ฆฌ ์์ผ๋ก ๋ค์ด๊ฐ ์ ์์ต๋๋ค).๊ณต๊ฐ ํค ํ์ผ ์
๋ก๋๊ฐ ์๋ฃ๋์์ต๋๋ค. Key pair name์ ์ฌ์ฉํ ํค ์ด๋ฆ์ ์ง์ ํฉ๋๋ค. Public key contents์๋ ์๋์ผ๋ก ์
๋ก๋ ๋ id_rsa.pub
ํ์ผ์ ๋ด์ฉ์ด ํ์๋ฉ๋๋ค. [Load public key from file]
๋ก ํ์ผ ์
๋ก๋๋ฅผ ํ์ง ์๊ณ id_rsa.pub
ํ์ผ ๋ด์ฉ์ ๋ณต์ฌํด์ Public key contents ๋ถ๋ถ์ ๋ถ์ฌ๋ฃ๊ธฐ ํด๋ ๋ฉ๋๋ค.

[Import]
ํค ๋ฒํผ์ ํด๋ฆญํฉ๋๋ค.
[NETWORK & SECURITY]
โ [Key Pairs]
)์์ id_rsa.pub
ํ์ผ์ด ์ถ๊ฐ๋ ๊ฒ์ ํ์ธํ ์ ์์ต๋๋ค.