ㅁ client side


#1. gen key


ssh-keygen -t rsa -C "comment_server_name"

Enter file in which to save the key (/home/user/.ssh/id_rsa): /home/user/.ssh/my_ssh_key # 키이름을 넣음

Enter passphrase (empty for no passphrase): ********** # 최초 등록시 사용할 비밀문구를 입력함


-t : 키타입 [ rsa | dsa ]

-C : 코멘트. 없어도 상관없음


/home/user/.ssh/id_rsa

/home/user/.ssh/id_rsa.pub

키파일이 생김. 생성된 키파일중 pub 키 파일을 서버에 등록하면 됨. 


#2. pubkey 파일 전송


scp /home/user/.ssh/id_rsa.pub user@{host}:/home/user/.ssh/t_id_rsa.pub


 ㅁ server side

#3. authorized_keys생성

cd /home/user/.ssh

cat t_id_rsa.pub >> ~/.ssh/authorized_keys


만약 authorized_keys 파일이 없다면 생성되겠지만, 바로 적용 안됨. 

chmod 644 ~/.ssh/authoized-keys


+ Recent posts