Cygwin Not Connecting via SSH

I have a scheduled task that is setup to run a command with Cygwin each night to backup files to a Linux machine. I would find Bash and SSH processes left running but the backup didn’t start. This is because I needed permissions to the /cygwin/etc/group and /cygwin/etc/passwd files setup correctly for the user account that’s running the backup.

This is what the task is set to run “c:cygwinbinbash.exe -l -c /home/backup/rbackup_redirect”

To troubleshoot I would schedule the backup for a few minutes ahead. It would fail running under the backup user account. I tried it on an admin account and the backup account, which isn’t an admin, by manually starting it in Cygwin. The admin account would work. The backup account wouldn’t. I then watched the SSH traffic on the Linux server as I manually started the backup. I saw that it would attempt to connect but fail when started from the backup account. It would hang for some time not moving on to the next step then stop trying. On the windows system Bash and SSH would still be running but on the Linux system SSH would stop running.

When I start Cygwin under the backup user account it would give a message saying that I may not be in the right group and I may need to rebuild /cygwin/etc/group and /cygwin/etc/passwd but it would go on to bash and let me run commands like normal. I tried rebuilding them. That didn’t work. I checked the file permissions on those files and found the issue. Just adding the backup user account didn’t work though. I had to actually delete the files. Make new ones that were blank. Then add the backup user account to have full rights. Then I rebuilt the files & SSH connections work fine.