天天看點

Windows 7 遠端登入 ubuntu12.04(PuTTY實作)

      以前看過一些資料說ubuntu預設是安裝ssh的,而我是自己安裝了一個ssh,并且安裝之後,看到ssh服務已經啟動。總之目的就是希望有一個ssh服務,并且已經啟動,如果沒有安裝,就先安裝一個;如果該服務沒有啟動,就啟動一下,由于我的已經啟動了,是以我沒有考慮這個問題。關于啟動ssh服務,我在網上看到的資料是:

[email protected]:~$ /etc/init.d/ssh start
           

安裝一個ssh伺服器,我的做法是在終端輸入ssh,然後按Tab鍵補全,選擇安裝伺服器。

[email protected]:~$ sudo apt-get install ssh
ssh                     ssh-contact-service     ssh-krb5
ssh-askpass             sshfp                   sshm
ssh-askpass-fullscreen  sshfs                   sshmenu
ssh-askpass-gnome       sshfs-dbg               sshpass
ssh-contact             sshguard                sshuttle
ssh-contact-client      ssh-import-id           
[email protected]:~$ sudo apt-get install ssh-contact-service
           

之後我輸入密碼進行安裝。

[sudo] password for wahaha:
 正在讀取軟體包清單... 完成
正在分析軟體包的依賴關系樹       
正在讀取狀态資訊... 完成       
将會安裝下列額外的軟體包:
  openssh-server ssh-import-id
建議安裝的軟體包:
  rssh molly-guard openssh-blacklist openssh-blacklist-extra monkeysphere
下列【新】軟體包将被安裝:
  openssh-server ssh-contact-service ssh-import-id
更新了 0 個軟體包,新安裝了 3 個軟體包,要解除安裝 0 個軟體包,有 0 個軟體包未被更新。
需要下載下傳 352 kB 的軟體包。
解壓縮後會消耗掉 944 kB 的額外空間。
您希望繼續執行嗎?[Y/n]y
擷取:1 http://cn.archive.ubuntu.com/ubuntu/ precise-updates/main openssh-server amd64 1:5.9p1-5ubuntu1.3 [338 kB]
擷取:2 http://cn.archive.ubuntu.com/ubuntu/ precise/universe ssh-contact-service amd64 0.6-1build1 [7,476 B]
擷取:3 http://cn.archive.ubuntu.com/ubuntu/ precise/main ssh-import-id all 2.10-0ubuntu1 [6,598 B]
下載下傳 352 kB,耗時 1秒 (314 kB/s)      
正在預設定軟體包 ...
Selecting previously unselected package openssh-server.
(正在讀取資料庫 ... 系統目前共安裝有 320267 個檔案和目錄。)
正在解壓縮 openssh-server (從 .../openssh-server_1%3a5.9p1-5ubuntu1.3_amd64.deb) ...
Selecting previously unselected package ssh-contact-service.
正在解壓縮 ssh-contact-service (從 .../ssh-contact-service_0.6-1build1_amd64.deb) ...
Selecting previously unselected package ssh-import-id.
正在解壓縮 ssh-import-id (從 .../ssh-import-id_2.10-0ubuntu1_all.deb) ...
正在處理用于 man-db 的觸發器...
正在處理用于 ureadahead 的觸發器...
正在處理用于 ufw 的觸發器...
正在設定 openssh-server (1:5.9p1-5ubuntu1.3) ...
Creating SSH2 RSA key; this may take some time ...
Creating SSH2 DSA key; this may take some time ...
Creating SSH2 ECDSA key; this may take some time ...
ssh start/running, process 27543
正在設定 ssh-contact-service (0.6-1build1) ...
正在設定 ssh-import-id (2.10-0ubuntu1) ...
[email protected]:~$
           

之後我檢測ssh服務有沒有啟動,根據顯示的資訊可知,我的已經啟動了。

[email protected]:~$ ps -e | grep ssh
  602 ?        00:00:00 sshd
 2082 ?        00:00:00 ssh-agent
[email protected]:~$
           

然後我下載下傳一個PuTTY的軟體,下載下傳完之後,直接輕按兩下運作。

Windows 7 遠端登入 ubuntu12.04(PuTTY實作)

然後我檢視我電腦的IP。

[email protected]:~$ ifconfig 
eth0      Link encap:以太網  硬體位址 08:60:6e:14:00:cf  
          UP BROADCAST MULTICAST  MTU:1500  躍點數:1
          接收資料包:0 錯誤:0 丢棄:0 過載:0 幀數:0
          發送資料包:0 錯誤:0 丢棄:0 過載:0 載波:0
          碰撞:0 發送隊列長度:1000 
          接收位元組:0 (0.0 B)  發送位元組:0 (0.0 B)

lo        Link encap:本地環回  
          inet 位址:127.0.0.1  掩碼:255.0.0.0
          inet6 位址: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  躍點數:1
          接收資料包:6027 錯誤:0 丢棄:0 過載:0 幀數:0
          發送資料包:6027 錯誤:0 丢棄:0 過載:0 載波:0
          碰撞:0 發送隊列長度:0 
          接收位元組:650313 (650.3 KB)  發送位元組:650313 (650.3 KB)

wlan0     Link encap:以太網  硬體位址 20:68:9d:f7:53:f1  
          inet 位址:218.87.104.65  廣播:218.87.104.127  掩碼:255.255.255.128
          inet6 位址: fe80::2268:9dff:fef7:53f1/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  躍點數:1
          接收資料包:43824 錯誤:0 丢棄:0 過載:0 幀數:0
          發送資料包:27107 錯誤:0 丢棄:0 過載:0 載波:0
          碰撞:0 發送隊列長度:1000 
          接收位元組:24782722 (24.7 MB)  發送位元組:4217911 (4.2 MB)

[email protected]:~$ 
           

然後我在Windows 7 進行ping,看看虛拟機和實體機之間的網絡是否暢通,根據顯示可知,它們之間已經互通了。

Microsoft Windows [版本 6.1.7600]
版權所有 (c) 2009 Microsoft Corporation。保留所有權利。

C:\Users\Li_Jun>ping 218.87.104.65

正在 Ping 218.87.104.65 具有 32 位元組的資料:
來自 218.87.104.65 的回複: 位元組=32 時間<1ms TTL=63
來自 218.87.104.65 的回複: 位元組=32 時間<1ms TTL=63
來自 218.87.104.65 的回複: 位元組=32 時間<1ms TTL=63
來自 218.87.104.65 的回複: 位元組=32 時間<1ms TTL=63

218.87.104.65 的 Ping 統計資訊:
    資料包: 已發送 = 4,已接收 = 4,丢失 = 0 (0% 丢失),
往返行程的估計時間(以毫秒為機關):
    最短 = 0ms,最長 = 0ms,平均 = 0ms

C:\Users\Li_Jun>
           

然後我就開始遠端登入。

Windows 7 遠端登入 ubuntu12.04(PuTTY實作)
Windows 7 遠端登入 ubuntu12.04(PuTTY實作)

最後顯示,我已經成功遠端登入了。

Windows 7 遠端登入 ubuntu12.04(PuTTY實作)

繼續閱讀