Cygwin SSH的目录权限(Windows 7)

Boo*_*ean 15 permissions ssh cygwin openssh windows-7

我是Linux的粉丝,但由于Linux中的英特尔无线驱动程序不好,我不得不切换到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.

此文件夹的权限显示为只读(仅适用于此文件夹),灰色检查.我试图取消选中但在我再次打开属性后,再次检查该框.有没有办法更改此文件夹的权限?

小智 8

很抱歉让这个老线程变得非常糟糕,但是当我搜索这个特定问题时,这个问题总会出现.

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

mkpasswd -l > /etc/passwd
mkgroup -l > /etc/group
Run Code Online (Sandbox Code Playgroud)

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

mkpasswd -l -d > /etc/passwd 
mkgroup -l -d > /etc/group
Run Code Online (Sandbox Code Playgroud)

或者,如果你拥有像我这样令人难以置信的大型网络,你可能并不是真的想要那样.另一种方法是只使用本地用户和组加上您当前登录的任何一个用户和组:

mkpasswd -l > /etc/passwd
mkpasswd -c >> /etc/passwd
mkgroup -l > /etc/group
mkgroup -c >> /etc/group
Run Code Online (Sandbox Code Playgroud)

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

  • 从Cygwin 1.7.35开始,此建议已过时,其中获取用户名/组信息的默认方式来自本机Windows数据库(SAM或AD),具体取决于您的系统是否位于Windows域中.除非您非常具体地需要能够通过`/ etc`文件覆盖SAM/AD,否则您现在根本不应该拥有这些文件.请参阅[Cygwin用户指南中的第3章](https://cygwin.com/cygwin-ug-net/ntsec.html). (3认同)

kar*_*rts 5

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

在cygwin shell中试试这个 chmod 777 /var/run

  • 这对我不起作用.上面的chmod命令是no-op. (2认同)