사용자 도구

사이트 도구


linux:ssh

차이

문서의 선택한 두 판 사이의 차이를 보여줍니다.

차이 보기로 링크

양쪽 이전 판 이전 판
다음 판
이전 판
다음 판 양쪽 다음 판
linux:ssh [2019/08/21 14:01]
kwon37xi [no matching cipher found.]
linux:ssh [2019/11/13 23:07]
kwon37xi
줄 15: 줄 15:
   * ''id_rsa'' 파일은 개인키로 자신의 PC(Client)에 둔다.   * ''id_rsa'' 파일은 개인키로 자신의 PC(Client)에 둔다.
   * ''*.pub'' 파일은 공개키로 접속 대상 서버 계정의 ''~/.ssh/authorized_keys'' 파일에 그 내용을 추가한다.   * ''*.pub'' 파일은 공개키로 접속 대상 서버 계정의 ''~/.ssh/authorized_keys'' 파일에 그 내용을 추가한다.
-  * ''~/.ssh''에 있는 파일은 ''600'' 권한으로 설정해야한다.+  * ''~/.ssh''에 있는 파일은 ''600'' 권한으로 설정해야한다. 해당 디렉토리도 권한 확인이 필요하다.<code sh> 
 +chmod 700 ~/.ssh 
 +</code>
  
 ===== ssh-agent ===== ===== ssh-agent =====
줄 25: 줄 27:
 </code> </code>
   * 키 등록이 안 될 경우 키 파일의 권한이 **0600**이 맞는지 확인 해 본다.   * 키 등록이 안 될 경우 키 파일의 권한이 **0600**이 맞는지 확인 해 본다.
 +
 +<code sh>
 +chmod 600 ~/.ssh/id_rsa*
 +</code>
   * [[https://unix.stackexchange.com/questions/90853/how-can-i-run-ssh-add-automatically-without-a-password-prompt|ssh agent - How can I run ssh-add automatically, without a password prompt? - Unix & Linux Stack Exchange]]   * [[https://unix.stackexchange.com/questions/90853/how-can-i-run-ssh-add-automatically-without-a-password-prompt|ssh agent - How can I run ssh-add automatically, without a password prompt? - Unix & Linux Stack Exchange]]
  
줄 36: 줄 42:
     * [[http://haruair.com/blog/2219|ssh config로 ssh 접속 간편하게 하기]]     * [[http://haruair.com/blog/2219|ssh config로 ssh 접속 간편하게 하기]]
     * [[http://nerderati.com/2011/03/simplify-your-life-with-an-ssh-config-file/|Simplify Your Life With an SSH Config File]]     * [[http://nerderati.com/2011/03/simplify-your-life-with-an-ssh-config-file/|Simplify Your Life With an SSH Config File]]
 +    * 파일 권한<code sh>
 +chmod 600 ~/.ssh/config
 +</code>
   * ''~/.ssh/config''<code sh>   * ''~/.ssh/config''<code sh>
 # 기본형태. ~/.ssh/id_rsa 를 사용할 경우 혹은 일반 비밀번호 인증의 경우 # 기본형태. ~/.ssh/id_rsa 를 사용할 경우 혹은 일반 비밀번호 인증의 경우
줄 41: 줄 50:
     HostName IP 혹은 hostname     HostName IP 혹은 hostname
     User 계정명     User 계정명
 +    IdentitiesOnly yes
  
 # 특정 key 지정 # 특정 key 지정
줄 48: 줄 58:
     PreferredAuthentications publickey     PreferredAuthentications publickey
     IdentityFile ~/.ssh/[private key]     IdentityFile ~/.ssh/[private key]
 +    IdentitiesOnly yes
  
 # github.com git 계정 접속시에 대한 처리 # github.com git 계정 접속시에 대한 처리
 Host github.com Host github.com
 +    HostName github.com
     User git     User git
     IdentityFile ~/.ssh/[github private key]     IdentityFile ~/.ssh/[github private key]
 +    IdentitiesOnly yes
          
 # 동일 2차 도메인 사용시 # 동일 2차 도메인 사용시
줄 59: 줄 72:
     PreferredAuthentications publickey     PreferredAuthentications publickey
     IdentityFile ~/.ssh/[private key]     IdentityFile ~/.ssh/[private key]
 +    IdentitiesOnly yes
 </code> </code>
   * [[https://gist.github.com/jexchan/2351996|동일 HostName, 동일 User 다중 Key]] ''Host github.com-SSHID'' 에서 ''Host'' 의 값을 ''github.com-myid'' 형태로 특정 값을 줘서 처리할 수 있고, 그 뒤 부터 ssh ''github.com-myid'' 같은 호출이 정상 작동한다.   * [[https://gist.github.com/jexchan/2351996|동일 HostName, 동일 User 다중 Key]] ''Host github.com-SSHID'' 에서 ''Host'' 의 값을 ''github.com-myid'' 형태로 특정 값을 줘서 처리할 수 있고, 그 뒤 부터 ssh ''github.com-myid'' 같은 호출이 정상 작동한다.
 +    * [[https://stackoverflow.com/questions/7927750/specify-an-ssh-key-for-git-push-for-a-given-domain|Specify an SSH key for git push for a given domain - Stack Overflow]]
 +    * [[https://serverfault.com/questions/450796/how-could-i-stop-ssh-offering-a-wrong-key/450807#450807|gitolite - How could I stop ssh offering a wrong key? - Server Fault]] ''IdentitiesOnly yes'' 설정도 주는게 좋다. 그렇지 않으면 우선 순위상에 있는 다른 키 파일들 뒤에 ''IdentityFile''에 설정한 파일이 뒤로 추가되는 형태로 시도된다.(''~/.ssh/id_dsa, ~/.ssh/id_rsa'' 등이 더 우선된다)
  
 ===== 접속 유지 Keep connection ===== ===== 접속 유지 Keep connection =====
줄 149: 줄 165:
 <code> <code>
 Ciphers aes128-cbc,aes192-cbc,aes256-cbc Ciphers aes128-cbc,aes192-cbc,aes256-cbc
 +# 필요한 경우
 +KexAlgorithms +diffie-hellman-group1-sha1
 </code> </code>
  
linux/ssh.txt · 마지막으로 수정됨: 2023/01/30 17:19 저자 kwon37xi