zoukankan      html  css  js  c++  java
  • CYGWIN SSH

    点击桌面上的Cygwin,注意在win7中一定要以管理员身份运行,否则不能创建sshd服务。输入以下命令

    cd /bin

    ssh-host-config

    zpc@Lenovo-PC ~
    $ ssh
    ssh.exe          ssh-agent.exe    ssh-host-config  ssh-keyscan.exe
    ssh-add.exe      ssh-copy-id      ssh-keygen.exe   ssh-user-config

    zpc@Lenovo-PC ~
    $ ssh-host-config .
    usage:  [OPTION]...

    This script creates an OpenSSH host configuration.

    Options:
      --debug  -d            Enable shell's debug output.
      --yes    -y            Answer all questions with "yes" automatically.
      --no     -n            Answer all questions with "no" automatically.
      --cygwin -c <options>  Use "options" as value for CYGWIN environment var.
      --port   -p <n>        sshd listens on port n.
      --user   -u <account>  privileged user for service, default 'cyg_server'.
      --pwd    -w <passwd>   Use "pwd" as password for privileged user.
      --privileged           On Windows XP, require privileged user
                             instead of LocalSystem for sshd service.

    zpc@Lenovo-PC ~
    $

    zpc@Lenovo-PC ~
    $ ssh-host-config

    *** Info: Generating missing SSH host keys
    ssh-keygen: generating new host keys: RSA1 RSA DSA ECDSA ED25519
    *** Info: Creating default /etc/ssh_config file
    *** Info: Creating default /etc/sshd_config file

    *** Info: StrictModes is set to 'yes' by default.
    *** Info: This is the recommended setting, but it requires that the POSIX
    *** Info: permissions of the user's home directory, the user's .ssh
    *** Info: directory, and the user's ssh key files are tight so that
    *** Info: only the user has write permissions.
    *** Info: On the other hand, StrictModes don't work well with default
    *** Info: Windows permissions of a home directory mounted with the
    *** Info: 'noacl' option, and they don't work at all if the home
    *** Info: directory is on a FAT or FAT32 partition.
    *** Query: Should StrictModes be used? (yes/no) no

    *** Info: Privilege separation is set to 'sandbox' by default since
    *** Info: OpenSSH 6.1.  This is unsupported by Cygwin and has to be set
    *** Info: to 'yes' or 'no'.
    *** Info: However, using privilege separation requires a non-privileged account
    *** Info: 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)

    zpc@Lenovo-PC ~
    $ ssh-host-config

    *** Info: Generating missing SSH host keys
    *** 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: StrictModes is set to 'yes' by default.
    *** Info: This is the recommended setting, but it requires that the POSIX
    *** Info: permissions of the user's home directory, the user's .ssh
    *** Info: directory, and the user's ssh key files are tight so that
    *** Info: only the user has write permissions.
    *** Info: On the other hand, StrictModes don't work well with default
    *** Info: Windows permissions of a home directory mounted with the
    *** Info: 'noacl' option, and they don't work at all if the home
    *** Info: directory is on a FAT or FAT32 partition.
    *** Query: Should StrictModes be used? (yes/no) yes

    *** Info: Privilege separation is set to 'sandbox' by default since
    *** Info: OpenSSH 6.1.  This is unsupported by Cygwin and has to be set
    *** Info: to 'yes' or 'no'.
    *** Info: However, using privilege separation requires a non-privileged account
    *** Info: 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) no
    *** 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: It's not possible to use the LocalSystem account for services
    *** Info: that can change the user id without an explicit password
    *** Info: (such as passwordless logins [e.g. public key authentication]
    *** Info: via sshd) when having to create the user token from scratch.
    *** Info: For more information on this requirement, see
    *** Info: https://cygwin.com/cygwin-ug-net/ntsec.html#ntsec-nopasswd1

    *** Info: If you want to enable that functionality, it's required to create
    *** Info: a new account with special privileges (unless such an 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 'LENOVO-PCcyg_server' (Cygwin nam
    e: 'cyg_server')? (yes/no) no
    *** ERROR: There was a serious problem creating a privileged user.
    *** Query: Do you want to proceed anyway? (yes/no) 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.

    *** Warning: Host configuration exited with 1 errors or warnings!
    *** Warning: Make sure that all problems reported are fixed,
    *** Warning: then re-run ssh-host-config.

    zpc@Lenovo-PC ~
    $ net start sshd
    CYGWIN sshd 服务正在启动 .
    CYGWIN sshd 服务已经启动成功。

    zpc@Lenovo-PC ~
    $ ssh 127.0.0.1
    The authenticity of host '127.0.0.1 (127.0.0.1)' can't be established.
    zpc@127.0.0.1's password:

    zpc@Lenovo-PC ~
    $ exit
    logout
    Connection to 127.0.0.1 closed.

    zpc@Lenovo-PC ~
    $

  • 相关阅读:
    软件工程逃课小组——冲刺集合
    软件工程逃课小组——冲刺日志(第一天)
    2020软件工程作业05
    软工实践第四次作业
    第三次
    第二次作业
    2020软件工程作业01
    Ubantu18安装SU(Seismic Unix)脚本
    Win10下通过anaconda搭建新环境并安装tensorflow-gpu
    Win10安装虚拟机(Ubantu18.04)并安装seismic unix(SU)
  • 原文地址:https://www.cnblogs.com/zhang-pengcheng/p/4217548.html
Copyright © 2011-2022 走看看