CYGWIN SSH Server 配置

OS:  Windows Server 2003 R2
 
1.   從 [url]www.cywin.com[/url]  下載 setup.exe 安裝引導程序
 
2.  雙擊 setup.exe 開始安裝
 
3.  選擇安裝源 Install for  Internet ( 若是有上次從 Internet 下載的軟件包,能夠選擇 Install for Local Directory  選擇存放的目錄便可)
 
4.  定義安裝目錄 C:\cygwin   (1)   Install for : All Users  (2)  Default Text File Type: Unix/binary
 
5. 定義下載軟件所存放目錄,(下次能夠使用下載包從本地硬盤進行安裝) .G:\Download\cywin
 
6. 選擇鏈接 Internet 的類型,根據本身的實際狀況選擇
 
7.  選擇一個鏡像下載站點
 
8.  選擇安裝軟件包
 
  (1)  Admini  中選擇:  cygrunsrv
 
 (2)  DOC  中選擇: cygwin-doc
 
 (3)  Net 中選擇: openssh
 
9. cywin 自動下載選擇的軟件包,並進行安裝。
 
10. 在個人電腦->屬性->高級->環境變量中配置加入變量CYGWIN=ntsec,
    在path環境變量中加入cygwin\bin路徑, 例如: ;c:\cygwin\bin
 
11. 雙擊Windows上安裝好的 Cywin快捷圖標,啓動 Cywin
Copying skeleton files.
These files are for the user to personalise
their cygwin experience.
These will never be overwritten.
`./.bashrc' -> `/home/Administrator//.bashrc'
`./.bash_profile' -> `/home/Administrator//.bash_profile'
`./.inputrc' -> `/home/Administrator//.inputrc'
 
12.  給文件受權,以完成sshd 服務的安裝
chmod +r /etc/group
chmod +r /etc/passwd
chmod +rwx /var
 
13.  安裝 sshd 服務
$ ssh-host-config
 
 
  詳細的安裝步驟,以及輸入的參數,以下所例:
Copying skeleton files.
These files are for the user to personalise
their cygwin experience.
 
These will never be overwritten.
 
`./.bashrc' -> `/home/Administrator//.bashrc'
`./.bash_profile' -> `/home/Administrator//.bash_profile'
`./.inputrc' -> `/home/Administrator//.inputrc'
 
Administrator@backup ~
$ chmod +r /etc/group    # 對文件權限
 
Administrator@backup ~
$ chmod +r /etc/passwd    # 對文件權限
 
Administrator@backup ~
$ chmod +rwx /var/    # 對文件權限
 
Administrator@backup ~
$ ssh-host-config      # 引導 SSH 服務配置
*** Info: Generating /etc/ssh_host_key
*** Info: Generating /etc/ssh_host_rsa_key
*** Info: Generating /etc/ssh_host_dsa_key
*** Info: Creating default /etc/ssh_config file
*** Info: Creating default /etc/sshd_config file
*** Info: Privilege separation is set to yes by default since OpenSSH 3.3.
*** Info: However, this requires a non-privileged account called 'sshd'.
*** Info: For more info on privilege separation read /usr/share/doc/openssh/READ
ME.privsep.
*** Query: Should privilege separation be used? (yes/no) yes  # 輸入 yes
*** Info: Updating /etc/sshd_config file
 
 
*** Warning: The following functions require administrator privileges!
 
*** Query: Do you want to install sshd as a service?
*** Query: (Say "no" if it is already installed as a service) (yes/no) yes  # 輸入 yes
*** Info: Note that the CYGWIN variable must contain at least "ntsec"
*** Info: for sshd to be able to change user context without password.
*** Query: Enter the value of CYGWIN for the daemon: [ntsec] ntsec  # 輸入 ntsec
*** Info: On Windows Server 2003, Windows Vista, and above, the
*** Info: SYSTEM account cannot setuid to other users -- a capability
*** Info: sshd requires.  You need to have or to create a privileged
*** Info: account.  This script will help you do so.
 
*** Info: You appear to be running Windows 2003 Server or later.  On 2003 and
*** Info: later systems, it's not possible to use the LocalSystem account
*** Info: for services that can change the user id without an explicit password
*** Info: (such as passwordless logins [e.g. public key authentication] via sshd
).
 
*** Info: If you want to enable that functionality, it's required to create a ne
w
*** Info: account with special privileges (unless a similar account already exis
ts).
*** Info: This account is then used to run these special servers.
 
*** Info: Note that creating a new user requires that the current account have
*** Info: Administrator privileges itself.
 
*** Info: No privileged account could be found.
 
*** Info: This script plans to use 'cyg_server'.
*** Info: 'cyg_server' will only be used by registered services.
*** Query: Do you want to use a different name? (yes/no) no  # 輸入 no ,不指定啓動用戶
*** Query: Create new privileged user account 'cyg_server'? (yes/no) no  # 輸入 no ,不指定啓動用戶
*** ERROR: There was a serious problem creating a privileged user.
*** Query: Do you want to proceed anyway? (yes/no) yes  # 輸入 yes
*** Warning: Expected privileged user 'cyg_server' does not exist.
*** Warning: Defaulting to 'SYSTEM'
 
*** Info: The sshd service has been installed under the LocalSystem
*** Info: account (also known as SYSTEM). To start the service now, call
*** Info: `net start sshd' or `cygrunsrv -S sshd'.  Otherwise, it
*** Info: will start automatically after the next reboot.
 
*** Info: Host configuration finished. Have fun!
 
Administrator@backup ~
$ cygrunsrv.exe -S sshd  # 啓動 SSH 服務
 
14. 安裝完成後,檢查一下系統服務中是否有 CYGWIN sshd 服務, 無啓動賬號.
 
15. 檢查系統用戶 sshd 是否已啓用, 並屬於管理員組.
 
16. 一切正常,便可啓動ssh服務. 登陸的用戶名是sshd, 密碼是 sshd用戶的密碼.
 
 
注意: 使用 windows 用戶本地認證
 
mkpasswd -l > /etc/passwd  使用windows 用戶的密碼
mkgroup -l > /etc/group    使用windows 用戶組
相關文章
相關標籤/搜索