windows 7架設OpenSSH伺服器實踐_win伺服器

來源:互聯網
上載者:User

最近有個想法就是在自己的電腦開個ssh服務,然後在遠程如果需要在自己電腦上工作的時候就只需要ssh串連到自己的電腦然後用mstsc remote desktop串連到自己的電腦IP上就可以了。

1.下載OpenSSH:http://www.jb51.net/softs/420320.html
2.安裝,反正我是全都預設一路走下來,期間跳出個視窗說要編輯passwd檔案的警告,OK繼續搞下去。
3.切換到SSH安裝目錄下的bin
4.

複製代碼 代碼如下:

# create the default groups
mkgroup -l >> ../etc/group
#create the default users
mkpasswd -l >> ../etc/passwd
# Note: for neither of the above commands did I bother with the domain version documented in the quickstart
# Now, if you look in ../etc/passwd, you will see entries (one per line) for all your Windows users.
# Start the server in debug mode
cd ../usr/sbin
sshd -d -d -d

5.出現如下提示

複製代碼 代碼如下:

debug1: sshd version OpenSSH_3.8.1p1
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0644 for '/etc/ssh_host_rsa_key' are too open.
It is recommended that your private key files are NOT accessible by others.
This private key will be ignored.
bad permissions: ignore key: /etc/ssh_host_rsa_key
Could not load host key: /etc/ssh_host_rsa_key
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0644 for '/etc/ssh_host_dsa_key' are too open.
It is recommended that your private key files are NOT accessible by others.
This private key will be ignored.
bad permissions: ignore key: /etc/ssh_host_dsa_key
Could not load host key: /etc/ssh_host_dsa_key
Disabling protocol version 2. Could not load host key
sshd: no hostkeys available -- exiting.

6.可以看出是設定檔的許可權沒有配置好,於是chown chmod之

複製代碼 代碼如下:

cd ../../etc
../bin/chown <username> *
../bin/chmod 600 *

7.發現貌似cygwin的dll檔案出了問題,參考貼裡面提供了更新的dll檔案的連結cygintl-2和cygwin1.dll,地址是http://samanthahalfon.net/resources/cygwin_includes.zip,將其中的兩個dll解壓覆蓋bin目錄下的老檔案,如果提示許可權不足,可能是因為cygrunsrv進程還是活著的,使用了這個dll檔案,殺掉cygrunsrc進程完成替換

8.重啟opensshd服務

net start opensshd

9.系統提示服務啟動成功,我們可以用ssh命令或者putty來實驗一下

複製代碼 代碼如下:

ssh <username>@<ip_windows_machine>
# You will be prompted to accept the authenticity of host, type yes
# You will be prompted for a password

# Enter your windows password

10.實驗成功,串連到自己的機器了

備忘:

sshd -d -d -d執行不了,但是不影響啟停openssh服務的進程。
sshd.exe – 系統錯誤
無法啟動此程式,因為電腦中丟失 cygcrypto-0.9.7.dll。嘗試重新安裝該程式以解決此問題。

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.