[kr-dev] 암호입력 없이 SSH 로그인 하는 방법

in #kr6 years ago (edited)



[그림 : 암호없이 원격로그인]

1. 로컬 PC에 키 생성

공개키 암호화 (RSA 암호 기반 PKI (public / private key) 생성)

공개키 암호의 구체적인 알고리즘으로는 RSA 암호타원곡선 암호(Elliptic Curve Cryptography) 등이 있으며, 현재는 RSA가 주로 사용되고 있습니다. RSA 암호는 개발자인 Rivest, Shamir, Adleman의 머리글자를 따서 지은 명칭입니다.

커맨드

ssh-keygen

호출 결과

Generating public/private rsa key pair.
Enter file in which to save the key (/Users/wonsama/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /Users/wonsama/.ssh/id_rsa.
Your public key has been saved in /Users/wonsama/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:b4g1UUqAtgPFXzwnZyxtbg6iWexcdgZZ5n166RmBaX0 [email protected]
The key's randomart image is:
+---[RSA 2048]----+
|   o...o.=+      |
|  . +  .O=B. +   |
|   o + .o@. = + E|
|    o = +.=. o + |
|     B +S*  . +  |
|      . . o   o  |
|         .       |
|                 |
+----[SHA256]-----+

2. 원격지(암호 없이 로그인 하고자 하는 PC)에 키 복사

커맨드

# 유저명@IP주소
ssh-copy-id [email protected]

# 또는 ssh를 다른 포트로 설정한 경우 "유저@IP주소 -p 포트번호" 
ssh-copy-id "user@host -p 1234"

호출 결과

/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/Users/wonsama/.ssh/id_rsa.pub"
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
[email protected]'s password:

Number of key(s) added:        1

Now try logging into the machine, with:   "ssh '[email protected]'"
and check to make sure that only the key(s) you wanted were added.

3. 참조링크

https://help.ubuntu.com/community/SSH/OpenSSH/Keys


이전 관련 글은 #w-dev 태그를 통해 확인하실 수 있습니다.
오늘도 행복한 하루 되세요 from @wonsama
Sort:  

전 개발자는 아니라서 잘은 모르겠지만 원사마님은 능력자이신거 같습니다. !^^

별 말씀을요, 응원 감사합니다.

하하하하.... 그냥 웃습니다!!

하하하하 뭐 별거 있나요 ㅋ

패스워드는 정말 번거로워요. 내가 나인데... 그걸 몰라줘요. ㅠ

그러니까요 ㅜㅜ 으... 귀차니즘

pairplay 가 kr-dev 컨텐츠를 응원합니다! :)

Coin Marketplace

STEEM 0.17
TRX 0.15
JST 0.028
BTC 56714.19
ETH 2341.70
USDT 1.00
SBD 2.37