사용자 도구

사이트 도구


linux:ssh

차이

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

차이 보기로 링크

양쪽 이전 판 이전 판
다음 판
이전 판
linux:ssh [2020/06/24 10:28]
kwon37xi [no matching cipher found.]
linux:ssh [2023/01/30 17:19] (현재)
kwon37xi [no matching cipher found.]
줄 5: 줄 5:
   * [[http://server.dzone.com/articles/9-ssh-do%E2%80%99s-and-don%E2%80%99ts|9 SSH Do’s and Don’ts]]   * [[http://server.dzone.com/articles/9-ssh-do%E2%80%99s-and-don%E2%80%99ts|9 SSH Do’s and Don’ts]]
   * [[http://www.cyberciti.biz/faq/linux-unix-test-internet-connection-download-upload-speed/|Linux / Unix: Test Internet Connection Speed From Console Over SSH Command Line]]   * [[http://www.cyberciti.biz/faq/linux-unix-test-internet-connection-download-upload-speed/|Linux / Unix: Test Internet Connection Speed From Console Over SSH Command Line]]
 +  * [[linux:ssh:tunnel|SSH Tunneling]]
   * [[linux:asbrucm|asbru-cm]]   * [[linux:asbrucm|asbru-cm]]
   * [[linux:pac|PAC]]   * [[linux:pac|PAC]]
 +  * [[:tabby|tabby]]
 +  * [[linux:ssh:keychain|ssh keychain]]
 +  * [[linux:electerm|electerm]]
 +  * [[linux:scp|scp]]
  
 ===== Private Key 생성 ===== ===== Private Key 생성 =====
줄 20: 줄 25:
   * ''~/.ssh''에 있는 파일은 ''600'' 권한으로 설정해야한다. 해당 디렉토리도 권한 확인이 필요하다.<code sh>   * ''~/.ssh''에 있는 파일은 ''600'' 권한으로 설정해야한다. 해당 디렉토리도 권한 확인이 필요하다.<code sh>
 chmod 700 ~/.ssh chmod 700 ~/.ssh
 +</code>
 +
 +==== 서버의 ''~/.ssh/authorized_keys'' 에 파일추가 ====
 +  * [[https://linux.die.net/man/1/ssh-copy-id|ssh-copy-id(1) - Linux man page]] 명령으로 추가 가능.
 +
 +<code sh>
 +ssh-copy-id -f -i id_rsa.pub username@host
 </code> </code>
  
줄 35: 줄 47:
 </code> </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]]
 +  * [[https://wiki.gnome.org/Projects/GnomeKeyring/Ssh|Projects/GnomeKeyring/Ssh - GNOME Wiki!]] 
 +  * [[linux:ssh:keychain|ssh keychain]] 
 +===== ssh-agent forwarding ===== 
 +  * local PC 에 원격 서버의 private key 를 두고, 이를 bastion 서버에 그대로 포워딩해주고, bastion 서버에서 해당 private key로 원격 서버에 접속 가능하게 한다. 
 +  * 이렇게 하면 공용 bastion 서버에 private key를 두지 않기 때문에 좀 더 안전해진다. 
 +  * [[https://aws.amazon.com/ko/blogs/security/securely-connect-to-linux-instances-running-in-a-private-amazon-vpc/|Securely Connect to Linux Instances Running in a Private Amazon VPC | AWS Security Blog]] 
 +  * [[https://docs.github.com/en/developers/overview/using-ssh-agent-forwarding|Using SSH agent forwarding - GitHub Docs]] 
 +  * [[https://sunshout.tistory.com/1893|Deep dive into Kernel :: SSH Agent forwarding]] 
 +  * [[https://www.cloudsavvyit.com/25/what-is-ssh-agent-forwarding-and-how-do-you-use-it/|What is SSH Agent Forwarding and How Do You Use It? – CloudSavvy IT]] 
 +  * [[https://dev.to/levivm/how-to-use-ssh-and-ssh-agent-forwarding-more-secure-ssh-2c32|SSH Agent Forwarding: How to use SSH properly and what is SSH Agent Forwarding - DEV Community]] 
 +  * ''ssh -A'' 옵션으로 포워딩
 ===== SSH 접속 인사 텍스트 ===== ===== SSH 접속 인사 텍스트 =====
   * ''/etc/motd'' 파일 편집하면 SSH 접속시 인사말을 지정할 수 있다.   * ''/etc/motd'' 파일 편집하면 SSH 접속시 인사말을 지정할 수 있다.
줄 80: 줄 102:
     * [[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://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'' 등이 더 우선된다)     * [[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'' 등이 더 우선된다)
 +    * ''ProxyCommand''
 +    * [[https://io.adafruit.com/blog/notebook/2016/09/27/ssh-config-includes/|SSH Config Includes]]
 +      * ''Include ~/.ssh/other_config''
  
 ===== 접속 유지 Keep connection ===== ===== 접속 유지 Keep connection =====
줄 154: 줄 179:
  
 ===== known_hosts 에 미리 호스트 추가 ===== ===== known_hosts 에 미리 호스트 추가 =====
-[[http://bcho.tistory.com/1227|SSH known_host 메모]]+  * [[http://bcho.tistory.com/1227|SSH known_host 메모]] 
 +  * [[https://linuxhint.com/category/ubuntu/|How to use ssh-keyscan on Ubuntu]] 
 +  * [[https://man.openbsd.org/ssh-keyscan.1|ssh-keyscan(1) - OpenBSD manual pages]]
 <code sh> <code sh>
 ssh-keyscan -t rsa host명 >> ~/.ssh/known_host ssh-keyscan -t rsa host명 >> ~/.ssh/known_host
줄 178: 줄 205:
 Host 123.123.123.123 Host 123.123.123.123
     KexAlgorithms +diffie-hellman-group1-sha1     KexAlgorithms +diffie-hellman-group1-sha1
 +    
 </code> </code>
  
줄 185: 줄 213:
 ssh -c aes128-cbc kwon37xi@xxx.xx.xx.xx ssh -c aes128-cbc kwon37xi@xxx.xx.xx.xx
 </code> </code>
 +
 +===== no match host key type found =====
 +  * 아래와 같은 형태의 메시지가 나온다면,
 +<code>
 +Unable to negotiate with 192.168.1.1 port 22: no matching host key type found. Their offer: ssh-dss, ssh-rsa
 +</code>
 +  * 위에서와 같이 전역으로 혹은 특정 ''Host'' 에 다음과 같이 설정한다.
 +<code sh>
 +
 +HostkeyAlgorithms ssh-dss,ssh-rsa
 +</code>
 +===== SSH Pipe =====
 +  * [[https://www.maketecheasier.com/ssh-pipes-linux/|How to Use SSH Pipes on Linux]]
 +
 +===== SSH RSA private key 를 공유해도 괜찮은가? =====
 +  * [[https://crypto.stackexchange.com/questions/2706/what-is-the-harm-if-i-publish-an-encrypted-rsa-private-key-publicly|public key - What is the harm if I publish an encrypted RSA private key publicly? - Cryptography Stack Exchange]]
 +  * **강력한 비밀번호로 passphrase를 걸었다면** 괜찮지만, bruteforce 공격에 대비해 주기적으로 바꿔주는게 좋다.
 +
 +
 +===== 참조 =====
 +  * [[https://blog.programster.org/ssh-agent-cheatsheet|SSH Agent Cheatsheet | Programster's Blog]]
  
linux/ssh.1592962136.txt.gz · 마지막으로 수정됨: 2020/06/24 10:28 저자 kwon37xi