[LINUX] ssh key 파일생성 및 접속

Posted by Albert 152Day 6Hour 43Min ago [2024-11-18]

1. ssh key 파일생성 (client상)

$ ssh-keygen -t rsa Generating public/private rsa key pair. Enter file in which to save the key (/home/ubuntu/.ssh/id_rsa): /home/ubuntu/.ssh/id_rsa already exists. Overwrite (y/n)? y Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/ubuntu/.ssh/id_rsa Your public key has been saved in /home/ubuntu/.ssh/id_rsa.pub The key fingerprint is: SHA256:Hashvalue ubuntu@ip- The key's randomart image is: +---[RSA 3072]----+ | .oooo..=oO| | ..o .o *.| | . . . o .o..| | . = . + . .o.| | . + S.. . o.| | ooo+ o +| | ++=.. E | | o ++. +| | +=o. .o| +----[SHA256]-----+


2. 접속하려는 linux서버의 계정에 생성한 id_rsa.pub 파일내용을 (authorized_keys 파일에) 복사해간다

복사위치: /home/username/.ssh/authorized_keys

권한 chmod변경 ---> .ssh  700  /  authorized_keys 600

 

3. client 상 ssh username@10.10.10.1 로 접속하면됨










LIST

Copyright © 2014 visionboy.me All Right Reserved.