SSH ํ‚ค ์ƒ์„ฑ

2978 ๋‹จ์–ด ssh-key
git๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๊ณผ์ •์—์„œ ๊ด€๋ จ ์„œ๋ฒ„๋ฅผ ๋งŒ๋“œ๋Š” SSH ํ‚ค๋ฅผ ์ดˆ๊ธฐํ™”ํ•ฉ๋‹ˆ๋‹ค.

1 ์‚ฌ์šฉ์ž ์ด๋ฆ„ ๋ฐ ๋ฉ”์ผ๋ฐ•์Šค ์„ค์ •


๊ฐœ๋ฐœ ๊ณผ์ •์—์„œ ์ œ์ถœํ•  ๋•Œ ๋กœ๊ทธ์— ์‚ฌ์šฉ์ž ์ด๋ฆ„๊ณผ ๋น„๋ฐ€๋ฒˆํ˜ธ๋ฅผ ํ‘œ์‹œํ•˜์—ฌ ๊ด€๋ฆฌํ•˜๊ธฐ ์‰ฝ์Šต๋‹ˆ๋‹ค.
$ git config --global user.name " "
$ git config --global user.email "937447974@qq.com"

2 ๊ธฐ์กด SSH ํ‚ค ํ™•์ธ


SSH keys๋ฅผ ๋งŒ๋“ค๊ธฐ ์ „์— ์ปดํ“จํ„ฐ์— SSH keys ๋น„๋ฐ€ ํ‚ค๊ฐ€ ์žˆ๋Š”์ง€ ๋ณผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
Terminal์„ ์—ด๊ณ  ๋‹ค์Œ ๋ช…๋ น์„ ์ž…๋ ฅํ•ฉ๋‹ˆ๋‹ค.
$ ls -al ~/.ssh

๋˜๋Š” ์ž…๋ ฅ
$ ls ~/.ssh

๋‹ค์Œ ํŒŒ์ผ์ด ํ‘œ์‹œ๋˜๋ฉด SSH keys๊ฐ€ ์ƒ์„ฑ๋˜์—ˆ์Œ์„ ๋‚˜ํƒ€๋ƒ…๋‹ˆ๋‹ค.
  • id_dsa.pub
  • id_ecdsa.pub
  • id_ed25519.pub
  • id_rsa.pub

  • ์ƒ์„ฑ๋œ SSH ํ‚ค๋ฅผ ๋ณด๊ณ  ๋‹ค์Œ ๋ช…๋ น์„ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.
    $ cd ~/.ssh
    $ cat id_rsa.pub

    3 ์ƒˆ SSH ํ‚ค ์ƒ์„ฑ


    SSH ํ‚ค๋ฅผ ๋งŒ๋“ค์ง€ ์•Š์œผ๋ฉด ์ƒˆ SSH ํ‚ค๋ฅผ ๋งŒ๋“ค ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
    1 ์ „์ž ๋ฉ”์ผ์„ ์„ค์ •ํ•˜๊ณ  ํ•ด๋‹นํ•˜๋Š” ํ‚ค๋ฅผ ๋งŒ๋“ญ๋‹ˆ๋‹ค.
    $ ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
    # Creates a new ssh key, using the provided email as a label
    Generating public/private rsa key pair.

    2 ํŒŒ์ผ ์ €์žฅ ์œ„์น˜๋ฅผ ์„ค์ •ํ•˜๊ณ  ์ง์ ‘ "Enter"ํ•ฉ๋‹ˆ๋‹ค.
    Enter a file in which to save the key (/Users/you/.ssh/id_rsa): [Press enter]

    3 ์•”ํ˜ธ๋ฅผ ์„ค์ •ํ•  ๋•Œ ๋นˆ ์•”ํ˜ธ๋ฅผ ์„ค์ •ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
    Enter passphrase (empty for no passphrase): [Type a passphrase]
    Enter same passphrase again: [Type passphrase again]

    4 ssh-agent์— SSH ํ‚ค ์ถ”๊ฐ€

    # start the ssh-agent in the background
    eval "$(ssh-agent -s)"
    Agent pid 59566
    
    $ssh-add ~/.ssh/id_rsa

    SSH ํ‚ค๊ฐ€ ์ƒ์„ฑ๋ฉ๋‹ˆ๋‹ค.
     

    Appendix



    Generating an SSH key

    Revision History


    ์‹œ๊ฐ„
    ๋ฌ˜์‚ฌ
    2016-03-01
    ๋ฐ•๋ฌธ ์™„์„ฑ

    CSDN:http://blog.csdn.net/y550918116j
    GitHub:https://github.com/937447974/Blog

    ์ข‹์€ ์›นํŽ˜์ด์ง€ ์ฆ๊ฒจ์ฐพ๊ธฐ