Usages of SSH key pair

Usages of SSH key pair

Generate SSH key pair

ssh-keygen

ssh-keygen -t rsa -b 4096 -f test
  • test.pub: Public Key
  • test: Private Key

Use key

Copy to remote system

Copy Public key to $REMOTE_HOST

ssh-copy-id $USER@$REMOTE_HOST -i test

or, if there is no public key in remote host

scp ~/.ssh/test.pub $USER@$REMOTE_HOST:.ssh/authorized_keys

Login use Private Key

ssh $USER@$REMOTE_HOST -i .ssh/test

./ssh/config

Edit ~/.ssh/config as following.

Host 1.2.3.4 test
    Hostname 1.2.3.4
    User username
    Port 22
    SendEnv LANG LC_*
    IdentityFile ~/.ssh/test

Connect remote system using ssh command

ssh test

크리에이티브 커먼즈 라이선스
이 저작물은 크리에이티브 커먼즈 저작자표시 4.0 국제 라이선스 에 따라 이용할 수 있습니다.

Share