windows如何使用ssh登入ubuntu

來源:互聯網
上載者:User
1.ssh的安裝
gavin@ubuntu:~$ sudo apt-get install ssh

2.產生密鑰

gavin@ubuntu:~$ ssh-keygen
Generating public/private rsa key pair.Enter file in which to save the key (/home/gavin/.ssh/id_rsa):         Created directory '/home/gavin/.ssh'.         Enter passphrase (empty for no passphrase):                 Enter same passphrase again:                 Passphrases do not match.  Try again.                 Enter passphrase (empty for no passphrase):                         Enter same passphrase again:                         Your identification has been saved in /home/gavin/.ssh/id_rsa.                         Your public key has been saved in /home/gavin/.ssh/id_rsa.pub.                         The key fingerprint is:                         7f:47:de:fd:11:74:af:5c:89:a4:58:48:5d:c0:21:6a gavin@ubuntu                         The key's randomart image is:                         +--[ RSA 2048]----+                         |         ooo+.   |                         |        o oo     |                         |       E . . . ..|                         |      .   o o o +|                         |        S. . ..oo|                         |         .   + +o|                         |          . . =.o|                         |           . .  o|                         |                .|                         +-----------------+

上述過程會提示輸入ssh的登入密碼,預設密鑰的位置在~/.ssh目錄中,這裡將公開金鑰改名為authorized_keys

gavin@ubuntu:~/cd .sshgavin@ubuntu:~/.ssh$ mv id_rsa.pub authorized_keys

3.修改設定檔,/etc/ssh/sshd_config

 gavin@ubuntu:~/.ssh$ sudo vi /etc/ssh/sshd_config......# AuthorizedKeysFile  %h/.ssh/authorized_keys.....

這裡將AuthorizedKeysFile前的#號去掉即可

4.到windows平台,啟動Puttygen,匯入先前產生的私密金鑰id_rsa,轉換成putty所識別的格式(*.ppk),得到檔案id_rsa.ppk.

5.windows上啟動putty,進行如下配置
Session-Logging-Hostname:填上你的linux的ip
Windows -Translation - 在下拉式功能表裡選上UTF-8,這裡不設定,登入後將會出現中文亂碼。
Connection- Data - Auto login username:填上你登入ubuntu時用的使用者名稱。
Connection- SSH-Auth-Private key file for authentication:選上id_rsa.ppk
儲存Session配置

6.開啟剛剛配置的ssh,成功登入

Using username "gavin".Authenticating with public key "imported-openssh-key"Passphrase for key "imported-openssh-key":Linux ubuntu 2.6.32-21-generic #32-Ubuntu SMP Fri Apr 16 08:10:02 UTC 2010 i686 GNU/LinuxUbuntu 10.04 LTSWelcome to Ubuntu! * Documentation:  https://help.ubuntu.com/409 packages can be updated.171 updates are security updates.Last login: Wed Jul  6 06:05:40 2011 from 192.168.27.112gavin@ubuntu:~$

7.其它事項
git帶有puttygen工具
密鑰的產生也可以直接使用puttygen
也可以不使用密鑰機制,這樣可以直接使用linux的使用者名稱及密碼登入

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.