Cygwin SSH 的目录权限 (Windows 7)

发布于 2024-08-19 05:21:22 字数 2061 浏览 4 评论 0原文

我是 Linux 的粉丝,但由于 Linux 中的 Intel 无线驱动程序很糟糕,我不得不切换到 Windows 7。我已经在 Windows 中安装了 Cygwin,并且想要配置 SSH 来远程连接到我的笔记本电脑。

我用Google搜索并找到安装信息Win 7 上的 openssh 服务器,但运行 ssh-host-config 时出现以下错误:

bala@bala-PC ~
$ ssh-host-config
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/READ
ME.privsep.
*** Query: Should privilege separation be used? (yes/no) no
*** 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
*** Query: Enter the value of CYGWIN for the daemon: []
*** 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.

*** Warning: The owner and the Administrators need
*** Warning: to have .w. permission to /var/run.
*** Warning: Here are the current permissions and ACLS:
*** Warning:     drwxr-xr-x 1 bala None 0 2010-01-17 22:34 /var/run
*** Warning:     # file: /var/run
*** Warning:     # owner: bala
*** Warning:     # group: None
*** Warning:     user::rwx
*** Warning:     group::r-x
*** Warning:     other:r-x
*** Warning:     mask:rwx
*** Warning:
*** Warning: Please change the user and/or group ownership,
*** Warning: permissions, or ACLs of /var/run.

*** ERROR: Problem with /var/run directory. Exiting.

此文件夹的权限显示为只读(仅适用于此文件夹) ,以灰色选中。我尝试取消选中,但再次打开属性后,该框再次被选中。有没有办法改变这个文件夹的权限?

I am a fan of Linux but due to bad Intel wireless drivers in Linux, I had to switch to Windows 7. I have installed Cygwin in Windows and want to configure SSH to remotely connect to my laptop.

I searched with Google and found information for installing openssh server on Win 7, but I am getting the following error when running ssh-host-config:

bala@bala-PC ~
$ ssh-host-config
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/READ
ME.privsep.
*** Query: Should privilege separation be used? (yes/no) no
*** 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
*** Query: Enter the value of CYGWIN for the daemon: []
*** 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.

*** Warning: The owner and the Administrators need
*** Warning: to have .w. permission to /var/run.
*** Warning: Here are the current permissions and ACLS:
*** Warning:     drwxr-xr-x 1 bala None 0 2010-01-17 22:34 /var/run
*** Warning:     # file: /var/run
*** Warning:     # owner: bala
*** Warning:     # group: None
*** Warning:     user::rwx
*** Warning:     group::r-x
*** Warning:     other:r-x
*** Warning:     mask:rwx
*** Warning:
*** Warning: Please change the user and/or group ownership,
*** Warning: permissions, or ACLs of /var/run.

*** ERROR: Problem with /var/run directory. Exiting.

The permissions of this folder are shown as read-only (only applies to this folder), checked in gray. I tried to uncheck but after I open the properties again, the box is again checked. Is there a way to change the permissions of this folder?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(9

烟凡古楼 2024-08-26 05:21:22

很抱歉揭开这样一个旧线程,但是当我用谷歌搜索这个特定问题时,这个问题总是出现。

几个月后,我终于找到了解决办法。当我设置 cygwin 时,我没有在 cygwin 中正确创建我的用户和组帐户。执行此操作的主要方法是运行:

mkpasswd -l > /etc/passwd
mkgroup -l > /etc/group

如果您使用域用户和密码登录,您可以执行以下操作:

mkpasswd -l -d > /etc/passwd 
mkgroup -l -d > /etc/group

或者,如果您有一个像我这样的非常大的网络,您可能并不真正想要这样。另一种方法是仅使用您的本地用户和组以及您当前登录的任何用户:

mkpasswd -l > /etc/passwd
mkpasswd -c >> /etc/passwd
mkgroup -l > /etc/group
mkgroup -c >> /etc/group

在我这样做之后,我终于能够正确运行 ssh-host-config 来创建服务。

Sorry to unbury such an old thread, but this question always came up when I googled this specific problem.

After a few months, I finally found a solution. When I set up cygwin, I didn't have my user and group accounts correctly created in cygwin. The main way to do this is to run:

mkpasswd -l > /etc/passwd
mkgroup -l > /etc/group

If you are logging in using a domain user and passwd, you can do:

mkpasswd -l -d > /etc/passwd 
mkgroup -l -d > /etc/group

Or, if you have an incredibly large network like mine, you may not really want that. An alternative is to just user your local users and group plus whatever one you are currently logged in as:

mkpasswd -l > /etc/passwd
mkpasswd -c >> /etc/passwd
mkgroup -l > /etc/group
mkgroup -c >> /etc/group

After I did this, I was finally able to run ssh-host-config correctly to create the service.

可是我不能没有你 2024-08-26 05:21:22

我在 Windows 7 x64 和 sshd 上运行 cygwin 1.7。我不记得运行 sshd_config 时遇到此错误,但我只是查看了 /var/run 目录,它设置为 777。

在 cygwin shell 中尝试此操作 chmod 777 /var/run

I'm running cygwin 1.7 on Windows 7 x64 and sshd. I don't remember getting this error when I ran sshd_config, but I just looked at my /var/run directory and it's set to 777.

Try this in a cygwin shell chmod 777 /var/run

赢得她心 2024-08-26 05:21:22

我自己也遇到了很多麻烦。我发现默认安装步骤可以正常工作,只要我:

  1. 使用“以管理员身份运行”选项以管理用户身份启动 Cygwin shell。
  2. 禁用 UAC。
  3. 禁用实时病毒防护。

执行这些步骤后,默认安装步骤为:

  1. 从 Cygwin 安装程序安装“openssh”。
  2. 使用“以管理员身份运行”选项以管理用户身份启动 Cygwin shell。
  3. 从 Cygwin shell 运行“ssh-host-config”。
  4. 权限分离:是
  5. 新本地帐户“sshd”:是
  6. 安装 sshd 作为服务:是
  7. CYGWIN 值:ntsec tty
  8. “cyg_server”的不同名称:否
  9. 创建新的特权用户帐户“cyg_server”:是
  10. 设置“cyg_server”密码并保存在safe place
  11. net start sshd

之后,Windows 7 Professional 和 Home 上的一切似乎都工作正常。

如果您的 Cygwin sshd 安装已经失败,最好完全卸载并重新开始。

如果您需要的话,这里是 Cygwin 卸载说明:http://cygwin。 com/faq/faq.html#faq.setup.uninstall-all

I had a lot of trouble with this myself. I have found that the default install steps work just fine provided that I:

  1. Start the Cygwin shell as an Administrative user with the "Run As Administrator" option.
  2. Have UAC disabled.
  3. Have real-time virus protection disabled.

Once these steps have been taken, the default install steps are:

  1. Install "openssh" from the Cygwin installer.
  2. Start the Cygwin shell as an Administrative user with the "Run As Administrator" option.
  3. Run "ssh-host-config" from the Cygwin shell.
  4. Privilege Separation: yes
  5. New local account "sshd": yes
  6. Install sshd as service: yes
  7. CYGWIN value: ntsec tty
  8. Different name for "cyg_server": no
  9. Create new privileged user account "cyg_server": yes
  10. Set "cyg_server" password and keep in a safe place
  11. net start sshd

After that, everything seems to work fine on both Windows 7 Professional and Home.

If you already have a failed Cygwin sshd installation, it may be best to do a full uninstall and start fresh.

Here are the Cygwin uninstall instructions if you need them: http://cygwin.com/faq/faq.html#faq.setup.uninstall-all

沉鱼一梦 2024-08-26 05:21:22

我首先必须删除损坏的安装:

cygrunsrv --remove sshd
rm -rf /var/log/sshd* /etc/ssh_host* /etc/sshd_config /var/empty

然后生成 passwd &如上所述的组:

mkpasswd -l > /etc/passwd
mkgroup -l > /etc/group

然后我跑了:

ssh-host-config -y
cygrunsrv --start sshd

最后“setuid failed”消息消失并且登录工作了。

I first had to remove the broken installation:

cygrunsrv --remove sshd
rm -rf /var/log/sshd* /etc/ssh_host* /etc/sshd_config /var/empty

then generate passwd & group as mentioned above:

mkpasswd -l > /etc/passwd
mkgroup -l > /etc/group

then I ran:

ssh-host-config -y
cygrunsrv --start sshd

and finaly the "setuid failed" messages dissapeared and login worked.

幻梦 2024-08-26 05:21:22

在 cygwin shell 中,确保您是管理员:

takeown /F "C:\cygwin" /R
icacls "C:\cygwin" /grant Everyone:\(F\) /T
icacls "C:\cygwin"
chmod 777 -R "c:\cygwin"

In a cygwin shell, make sure you are administrator then:

takeown /F "C:\cygwin" /R
icacls "C:\cygwin" /grant Everyone:\(F\) /T
icacls "C:\cygwin"
chmod 777 -R "c:\cygwin"
寄离 2024-08-26 05:21:22

在 Windows 资源管理器中,对于文件夹 /var

属性。
安全。
添加具有完全控制权的组管理员
文件夹和子文件夹。

这对我有用。

In Windows Explorer, for folder /var:

Properties.
Security.
Add group Administrators with full control for
the folder and subfolders.

It works for me.

梦言归人 2024-08-26 05:21:22

当我在 NTFS 类型的硬盘驱动器上安装 Cygwin 时,我只能成功运行 ssh-host-config 脚本。当我将 Cygwin 安装在 exFAT 类型的闪存驱动器上时,ssh-host-config 脚本不起作用。

I was only able to run the ssh-host-config script successfully when I installed Cygwin on a hard drive of type NTFS. The ssh-host-config script did not work when I had Cygwin installed on a flash drive of type exFAT.

还给你自由 2024-08-26 05:21:22

我也遇到了同样的问题。我相信我的问题是因为我有一个自定义的 /etc/fstab 文件,我在其中使用“noacl”选项安装根文件夹。以下是我解决问题的方法:

  1. 将自定义 /etc/fstab 移开:

    <前><代码> mv /etc/fstab /etc/fstab.bak

    或者,您可以编辑 /etc/fstab 文件并删除 noacl 选项。

  2. 关闭所有 Cygwin bash 窗口和任何其他 Cygwin 进程或服务。如果您有任何 Cygwin 进程正在运行,它将保留使用旧的 /etc/fstab 设置挂载的内容。

  3. 启动一个新的 Cygwin bash 窗口。

  4. 您可能需要运行以下命令。

    <前><代码>chmod +r /etc/passwd
    chmod o+x /var
    chmod +w /var/run

  5. 交叉手指,运行 ssh-host-config,它现在应该完成,没有错误。

  6. 如果您在步骤 1 中移动了 /etc/fstab,现在可以将其移回来:

     mv /etc/fstab.bak /etc/fstab
    
  7. 如果您在首次安装 Cygwin 后创建了新用户,请更新 /etc/passwd,否则这些用户可能无法通过 ssh 登录:

    mkpasswd -l > > /etc/密码
    
  8. 此外,请转到 Windows 防火墙,并允许 C: /cygwin/usr/sbin/sshd.exe 和 C:/cygwin/usr/sbin/sftp-server.exe

I was having the same problem. My problem, I believe, was because I had a custom /etc/fstab file where I was mounting the root folder with "noacl" option. Here is how I solved the problem:

  1. Move the custom /etc/fstab out of the way:

     mv /etc/fstab /etc/fstab.bak
    

    Alternatively, you can edit your /etc/fstab file and remove the noacl option.

  2. Close all Cygwin bash windows and any other Cygwin processes or services. If you have any Cygwin process running, it will keep things mounted with the old /etc/fstab settings.

  3. Start a new Cygwin bash window.

  4. You may need to run the following.

    chmod +r /etc/passwd
    chmod o+x /var
    chmod +w /var/run
    
  5. Cross your fingers, run ssh-host-config, and it should now complete without errors.

  6. If you moved your /etc/fstab in Step 1, you can move it back now:

     mv /etc/fstab.bak /etc/fstab
    
  7. If you created new users after you first installed Cygwin, update /etc/passwd, otherwise those users may not be able login via ssh:

    mkpasswd -l > /etc/passwd
    
  8. Also, go to Windows Firewall, and allow C:/cygwin/usr/sbin/sshd.exe and C:/cygwin/usr/sbin/sftp-server.exe

养猫人 2024-08-26 05:21:22

对于 Windows 用户,通过右键单击快捷方式运行“Cygwin Terminal”并以管理员身份运行....在此处输入图像描述

现在运行 "<从 Cygwin 终端中的“strong>ssh-host-config”...它肯定会起作用。

for windows Users run "Cygwin Terminal" by right-clicking on shortcut and run it as a administrator....enter image description here

Now Run "ssh-host-config" from the Cygwin Terminal...It will definitely work.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文