知识屋:更实用的电脑技术知识网站
所在位置:首页 > 操作系统 > linux

cygwin中配置ssh的过程记录

发布时间:2014-09-05 13:53:04作者:知识屋

cygwin中配置ssh的过程记录
 
第一步:配置ssh-host-config
lcm@lcmtool /bin
$ ssh-host-config
 
*** Info: Generating /etc/ssh_host_key
*** Info: Generating /etc/ssh_host_rsa_key
*** Info: Generating /etc/ssh_host_dsa_key
*** Info: Generating /etc/ssh_host_ecdsa_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/README.privsep.
*** Query: Should privilege separation be used? (yes/no) no
*** Info: Updating /etc/sshd_config file
*** Info: Creating default /etc/inetd.d/sshd-inetd file
*** Info: Updated /etc/inetd.d/sshd-inetd
 
*** 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: 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
*** Query: Create new privileged user account 'cyg_server'? (yes/no) yes
*** Info: Please enter a password for new user cyg_server.  Please be sure
*** Info: that this password matches the password rules given on your system.
*** Info: Entering no password will exit the configuration.
*** Query: Please enter the password:此处输入密码
*** Query: Reenter:确认密码
 
*** Info: User 'cyg_server' has been created with password 'miao66'.
*** Info: If you change the password, please remember also to change the
*** Info: password for the installed services which use (or will soon use)
*** Info: the 'cyg_server' account.
 
*** Info: Also keep in mind that the user 'cyg_server' needs read permissions
*** Info: on all users' relevant files for the services running as 'cyg_server'.
*** Info: In particular, for the sshd server all users' .ssh/authorized_keys
*** Info: files must have appropriate permissions to allow public key
*** Info: authentication. (Re-)running ssh-user-config for each user will set
*** Info: these permissions correctly. [Similar restrictions apply, for
*** Info: instance, for .rhosts files if the rshd server is running, etc].
 
 
*** 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 fun!
 
lcm@lcmtool /bin
$
第二步 启动服务
win7开始菜单-services.msc-找到CYGWIN sshd服务,将其启动
 
 
 
第三步 设置authorized_keys
lcm@lcmtool /bin
$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/lcm/.ssh/id_rsa):
Created directory '/home/lcm/.ssh'.
Enter passphrase (empty for no passphrase):直接回车
Enter same passphrase again:直接回车
Your identification has been saved in /home/lcm/.ssh/id_rsa.
Your public key has been saved in /home/lcm/.ssh/id_rsa.pub.
The key fingerprint is:
36:8e:03:0b:8d:2b:f7:6f:a6:2d:16:b8:b4:72:48:10 lcm@lcmtool
The key's randomart image is:
+--[ RSA 2048]----+
|                 |
|E                |
| .               |
|.  o             |
|. o.o   S        |
| .oo.o + .       |
|oooo..o .        |
|oo+.o.o.         |
| o .o*o          |
+-----------------+
 
lcm@lcmtool /bin
 
$ cd ..
 
lcm@lcmtool /
$ ls
bin       Cygwin.bat  Cygwin-Terminal.ico  etc     home  proc  tmp  var
cygdrive  Cygwin.ico  dev                  hadoop  lib   srv   usr
 
lcm@lcmtool /
$ cd hadoop
lcm@lcmtool /hadoop
$ cd ~/.ssh
 
lcm@lcmtool ~/.ssh
$ ls
id_rsa  id_rsa.pub
 
lcm@lcmtool ~/.ssh
$ cp id_rsa_pub authorized_keys
cp: 无法获取"id_rsa_pub" 的文件状态(stat): No such file or directory
 
lcm@lcmtool ~/.ssh
$ cp id_rsa.pub authorized_keys
 
lcm@lcmtool ~/.ssh
$ ls
authorized_keys  id_rsa  id_rsa.pub
 
lcm@lcmtool ~/.ssh
$
 
(免责声明:文章内容如涉及作品内容、版权和其它问题,请及时与我们联系,我们将在第一时间删除内容,文章内容仅供参考)
收藏
  • 人气文章
  • 最新文章
  • 下载排行榜
  • 热门排行榜