Google Cloud Platform SSH 연결 구성

2717 단어
먼저
  • 실례를 만들고 현재 사용자의 새 비밀번호를 설정합니다
  • $ sudo passwd ${whoami} //     user    ${whoami}
    #      
    
  • 루트의 새 비밀번호를 마음대로 설정하기
  • $ sudo passwd root
    #      
    

    로컬에서 개인 키와 공개 키 생성
    $ cd ~/.ssh
    $ ssh-keygen -f myKey
    Generating public/private rsa key pair.
    Enter passphrase (empty for no passphrase): (  private key       ,           )
    Enter same passphrase again: (          )
    Your identification has been saved in myKey.
    Your public key has been saved in myKey.pub.
    The key fingerprint is:
    SHA256:EW7ow1wCKAh1rM/GG08ZAwOy+7+SUiT0rFXY2f8mNvk [email protected]
    The key's randomart image is:
    +---[RSA 2048]----+
    |=.o+= o .        |
    |o+.o+= + .       |
    |o.o..oo *        |
    |..o+ +o+ o       |
    |.oo+  =+S o      |
    | o. * o. = o     |
    | ..o =  . =      |
    |. o.. .    E     |
    | . .o.           |
    +----[SHA256]-----+
    #          myKey.pub      myKey
    

    공개 키 복사
    $ cat myKey.pub
    ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCjHKPaeglRVJzAhNq+W
          。。。
    dKx8sJ0Rw4kUqm2eU2vo8S5IEA0Nk2f7BtVGE8VOCHgmDbv2tLp9845UVp1 [email protected]
    #            ,     [email protected]         SSH            ${whoami}
    

    공개 키 가져오기
    #           ->      ->     -> SSH   ,    
    #           public key     ~/.ssh/authorized_keys
    

    로컬에서 개인 키로 로그인
    $ ssh -i myKey [email protected]
    Enter passphrase for key 'myKey': (   private key   )
    Welcome to Ubuntu 16.04.2 LTS (GNU/Linux 4.11.2-041102-generic x86_64)
    
     * Documentation:  https://help.ubuntu.com
     * Management:     https://landscape.canonical.com
     * Support:        https://ubuntu.com/advantage
    
      Get cloud support with Ubuntu Advantage Cloud Guest:
        http://www.ubuntu.com/business/services/cloud
    
    83 packages can be updated.
    0 updates are security updates.
    
    
    Last login: Sun Oct  8 06:40:43 2017 from 115.200.175.117
    

    SSH 암호 확인을 통해 로그인
    $ ssh [email protected]
    Permission denied (publickey).
    
    #           ,               ,      
    $ sudo vi /etc/ssh/sshd_config
    PasswordAuthentication yes 
    :wq!
    
    #       ssh   
    $ sudo service sshd restart
    
    #     
    $ ssh [email protected]
    [email protected]'s password: (         )
    Welcome to Ubuntu 16.04.2 LTS (GNU/Linux 4.11.2-041102-generic x86_64)
    
     * Documentation:  https://help.ubuntu.com
     * Management:     https://landscape.canonical.com
     * Support:        https://ubuntu.com/advantage
    
      Get cloud support with Ubuntu Advantage Cloud Guest:
        http://www.ubuntu.com/business/services/cloud
    
    83 packages can be updated.
    0 updates are security updates.
    
    
    Last login: Sun Oct  8 06:59:24 2017 from 115.200.175.117
    
    #       
    

    좋은 웹페이지 즐겨찾기