在windows上配置cygwin时出现这样的错误怎么解决

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了在windows上配置cygwin时出现这样的错误怎么解决相关的知识,希望对你有一定的参考价值。

你参考一下这个信息:
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 用户组

配置完成后,你可以使用SecureCRT或者 putty等软件登陆连接ssh
参考技术A 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 用户组
配置完成后,你可以使用SecureCRT或者 putty等软件登陆连接ssh
参考技术B 执行下面几行命令试试看:
$ mkpasswd -l > /etc/passwd
$ mkgroup -l > /etc/group
$ cygrunsrv -R sshd 删除ssd服务
$ ssh-host-config -y 重新配置
$ cygrunsrv -S sshd 启动服务。

程序 .exe 在 cygwin 上运行,但在调试和在 Visual Studio 上运行时出现异常

【中文标题】程序 .exe 在 cygwin 上运行,但在调试和在 Visual Studio 上运行时出现异常【英文标题】:program .exe run on cygwin but give exception on debugging and running on visual studio 【发布时间】:2018-02-12 08:26:22 【问题描述】:

当我从 cygwin 调用它时,我可以运行我的程序。 但是当我想调试它时,在视觉 stdio 上,我得到以下异常:

Exception thrown at 0x610DDA44 (cygwin1.dll) in .exe: 0xC0000005: Access 
violation writing location 0x00000000.

If there is a handler for this exception, the program may be safely continued.

我将我的 cygwin1.dll 路径添加到我的项目环境中,但它不起作用。

我正在尝试通过此链接构建和运行 canfestival:https://canfestival.org/code 请帮忙解决这个异常。

【问题讨论】:

在为 PC 应用程序(Windows 和 Linux)编译的 C++ 代码中,通常无法写入 0x00000000 - 那是 nullptr。如果它在 VS 中运行但不在 cygwin 中运行,那么您的代码在 VS 中编译时会执行不同的操作。在 VS 编译代码中写入 nullptr 将失败,并出现完全相同的运行时错误。 你要么尝试调试代码 - 在 cygwin 上使用 gdb (但我从未尝试过 - 它可能远不如 VS 内置的可视化调试器方便)。或者,您可以尝试在最小的示例代码中隔离错误。可能是,它只是系统函数调用的未经检查的返回值,它在 cygwin 上意外失败,但在 VS 中却没有。看看Eric Lippert: How to debug small programs。有一次,你有这么少的样本但仍然卡住,你可以edit你的问题并将样本添加为minimal reproducible example。 其实我想用可视化stdio调试器@Scheff visual stdio 可能无法完全处理 cygwin 程序。如果是 cygwin 程序,请先尝试使用 gdb。 我发现原因是从makefile中删除-mno-cygwin标志,我切换到使用linux。 【参考方案1】:

正如 Scheff 所说,不建议将 vs 和 cygwin 结合使用。然后我努力在可视化stdio中制作我的库文件,现在不用cygwin也可以调试。如果无法使用 Visual Studio 制作库,也有很多人建议使用 GDB 等 cygwin 调试器。

【讨论】:

以上是关于在windows上配置cygwin时出现这样的错误怎么解决的主要内容,如果未能解决你的问题,请参考以下文章

安装cygwin中的make时出现了一下错误,应该怎么办啊,求大神解决!

程序 .exe 在 cygwin 上运行,但在调试和在 Visual Studio 上运行时出现异常

Win7安装时出现:“windows无法安装所需的文件,错误代码:0X80070570 ”这样的错误。这个怎么破?

在 Windows 上安装 Node 包时出现 ETIMEDOUT 错误

cygwin下安装hadoop,在启动namenode时出现下面问题

azure 应用服务上的 Angular 应用 - 从资产文件夹加载配置文件时出现 404 错误