Directory permissions for Cygwin SSH (Windows 7)

Boolean picture Boolean · Jan 29, 2010 · Viewed 46.3k times · Source

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?

Answer

Matthew Flower picture Matthew Flower · Jun 5, 2012

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.