Cygwin是许多软件的集合,最初由Cygnus Solutions开发,用于各种版本的Microsoft Windows上,运行UNIX类系统。Cygwin的主要目的是通过重新编译,将POSIX系统(例如Linux、BSD,以及其他Unix系统)上的软件移植到Windows上。Cygwin移植工作在Windows NT、Windows 2000、Windows XP以及Windows Server 2003上比较好,在Windows 95和Windows 98上,相对差劲一些。Cygwin由Red Hat等负责维护。
安装了Cygwin之后,就可以像操作Unix那样的操作windows了,下面简要介绍一下如何在Cygwin上面配置SSH服务,使得可以从远程的机器上访问这台Windows。
1. 给文件授权,以完成sshd 服务的安装
chmod +r /etc/group
chmod +r /etc/passwd
chmod +rwx /var
2. 安装 sshd 服务
-
$ ssh-host-config
-
-
*** Query: Overwrite existing /etc/ssh_config file? (yes/no) yes
-
*** Info: Creating default /etc/ssh_config file
-
*** Query: Overwrite existing /etc/sshd_config file? (yes/no) yes
-
*** 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/README.privsep.
-
*** Query: Should privilege separation be used? (yes/no) yes
-
*** Info: Updating /etc/sshd_config file
-
-
*** Query: Do you want to install sshd as a service?
-
*** Query: (Say "no" if it is already installed as a service) (yes/no) yes
-
*** Query: Enter the value of CYGWIN for the daemon: [] 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 XP 64bit, Windows 2003 Server,
-
*** Info: or later. On these systems, it's not possible to use the LocalSystem
-
*** Info: account for services that can change the user id without an
-
*** Info: explicit password (such as passwordless logins [e.g. public key
-
*** Info: authentication] via sshd).
-
-
*** Info: If you want to enable that functionality, it's required to create
-
*** Info: a new account with special privileges (unless a similar account
-
*** Info: already exists). This account is then used to run these special
-
*** Info: servers.
-
-
*** Info: Note that creating a new user requires that the current account
-
*** Info: have Administrator privileges itself.
-
-
*** Info: The following privileged accounts were found: 'cyg_server' .
-
-
*** 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
-
*** Query: Please enter the password for user 'cyg_server':
-
*** Query: Reenter:
-
-
-
*** Info: The sshd service has been installed under the 'cyg_server'
-
*** Info: account. To start the service now, call `net start sshd' or
-
*** Info: `cygrunsrv -S sshd'. Otherwise, it will start automatically
-
*** Info: after the next reboot.
-
-
*** Info: Host configuration finished. Have
Administrator@backup ~
$ cygrunsrv.exe -S sshd # 启动 SSH服务
安装完成后,系统服务中应该会有 CYGWIN sshd服务
一切正常,即可启动ssh服务. 登录的用户名是cyg_server, 密码是配置是设置的密码
3. 使用 windows 用户本地认证
mkpasswd -l > /etc/passwd 使用windows 用户的密码
mkgroup -l > /etc/group 使用windows 用户组
阅读(3233) | 评论(0) | 转发(1) |